1. Go to this page and download the library: Download quanzo/yii2-shortcode 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/ */
quanzo / yii2-shortcode example snippets
$config = [
'bootstrap' => [
'shortcode',
],
'modules' => [
'shortcode' => [
'class' => '\x51\yii2\modules\shortcode\Module',
'automatic' => false, // process content before output to browser
'exclude' => [ // Routes in which the use of shortcodes is prohibited. Use * and ? mask
'blocks/*',
],
'shortcodes' => [
'url' => function ($arParams, $content = '') { // use [url path="/site/index"]main page[/url]
if (!empty($arParams['path'])) {
$arUrl = [
$arParams['path']
];
foreach ($arParams as $name => $val) {
if ($name != 0 || $name != 'path') {
$arUrl[$name] = $val;
}
}
$href = Url::to($arUrl);
if ($content) {
return Html::a($content, $href);
} else {
return $href;
}
}
return '';
},
]
],
]
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.