PHP code example of alexeevdv / yii2-shortcodes

1. Go to this page and download the library: Download alexeevdv/yii2-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/ */

    

alexeevdv / yii2-shortcodes example snippets


use alexeevdv\yii\shortcodes\ShortcodeBehavior;

//...
'components' => [
    //...
    'view' => [
        'as shortcodeBehavior' => ShortcodeBehavior::class,
        'map' => [
            'feedback' => \frontend\widgets\ContactForm::class,
            'gallery' => [ 
                'class' => \frontend\widgets\GalleryWidget::class,
                'theme' => 'dark',
            ],
        ],
    ],
    //...
],
//...

namespace frontend\widgets;

class GalleryWidget extends \yii\base\Widget
{
    public $id;
    
    public $theme;
    
    public function run()
    {
        // render your gallery here using $id and $theme
    }
}

//Anywhere in your layouts, views or rendered content:

[gallery id=413]

bash
$ php composer.phar