PHP code example of yii2mod / yii2-cms

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

    

yii2mod / yii2-cms example snippets


'modules' => [
    'cms' => [
        'class' => 'yii2mod\cms\Module',
    ],
],

 'components' => [
     'urlManager' => [
         'rules' => [
             ['class' => 'yii2mod\cms\components\PageUrlRule'],
         ]
     ],
 ],

public function actions()
{
    return [
        'page' => [
            'class' => 'yii2mod\cms\actions\PageAction',
        ]
    ];
}

'modules' => [
    'cms' => [
        'class' => 'yii2mod\cms\Module',
        'froalaEditorOptions' => [
            // your custom configuration
            'clientPlugins' => [
            ],
            'clientOptions' => [
            ],
            'excludedPlugins' => [
            ],
        ],
    ],
],

'modules' => [
    'cms' => [
        'class' => 'yii2mod\cms\Module',
        'enableMarkdown' => true,
        // List of options: https://github.com/NextStepWebs/simplemde-markdown-editor#configuration
        'markdownEditorOptions' => [
            'showIcons' => ['code', 'table'],
        ],
    ],
],

namespace app\widgets;

use yii\base\Widget;

class MyWidget extends Widget
{
   /**
    * @inheritdoc
    */
   public function run()
   {
       parent::run();

       echo 'Text from widget';
   }

   /**
    * This function used for render the widget
    *
    * @return string
    */
   public static function show()
   {
       return self::widget();
   }
}

public function actions()
{
    return [
        'page' => [
            'class' => 'yii2mod\cms\actions\PageAction',
            'baseTemplateParams' => [
               'homeUrl' => 'your site home url',
               'siteName' => Yii::$app->name
            ]
        ],
    ];
}

public function actions()
{
    return [
        'page' => [
            'class' => 'yii2mod\cms\actions\PageAction',
            'commentWidgetParams' => [
                'maxLevel' => 1,
                'dataProviderConfig' => [
                    'pagination' => [
                        'pageSize' => 10
                    ],
                ],
            ]
        ]
    ];
}
bash
php composer.phar