PHP code example of brouwers / shortcodes
1. Go to this page and download the library: Download brouwers/shortcodes library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brouwers / shortcodes example snippets
[b class="bold"]Bold text[/b]
[tabs]
[tab]Tab 1[/tab]
[tab]Tab 2[/tab]
[/tabs]
[user id="1" display="name"]
"brouwers/shortcodes": "1.*"
'Brouwers\Shortcodes\ShortcodesServiceProvider',
'Shortcode' => 'Brouwers\Shortcodes\Facades\Shortcode',
$shortcode = App::make('shortcode');
return View::make('view')->withShortcodes();
Shortcode::enable();
Shortcode::disable();
return View::make('view')->withoutShortcodes();
Shortcode::compile($contents);
Shortcode::register('b', function($shortcode, $content, $compiler, $name)
{
return '<strong class="'. $shortcode->class .'">' . $content . '</strong>';
});
class BoldShortcode {
public function register($shortcode, $content, $compiler, $name)
{
return '<strong class="'. $shortcode->class .'">' . $content . '</strong>';
}
}
Shortcode::register('b', 'BoldShortcode');
class BoldShortcode {
public function custom($shortcode, $content, $compiler, $name)
{
return '<strong class="'. $shortcode->class .'">' . $content . '</strong>';
}
}
Shortcode::register('b', 'BoldShortcode@custom');
class BoldShortcode {
public function register($shortcode, $content, $compiler, $name)
{
return '<strong '. $shortcode->get('class', 'default') .'>' . $content . '</strong>';
}
}