= Yii 2 Theming = == Configuration == Setup theme in configuration file. For the basic application ''[app]/config/web.php'': 'basic', ... 'components' => [ 'view' => [ 'class' => 'yii\web\View', 'theme' => [ 'basePath' => '@app/themes/dirt', 'baseUrl' => '@web/../themes/dirt', 'pathMap' => [ '@app/views' => ['@app/themes/christmas', '@app/themes/dirt'], '@app/modules' => '@app/themes/dirt/modules', '@app/widgets' => '@app/themes/dirt/widgets', ], ], ], //'layout' => 'mycustomlayout', // `@web/themes/mytheme/views/` contain mycustomlayout.php in this case ], 'params' => $params, ]; ... == Create Theme == === Folder structure === Create theme in ''[app]/themes/[mytheme]/''. Anything below that should follow the ''[app]/views/'' folder structure, starting with ''layouts'', ''site'', etc. You can include additional folder for libraries and CSS files as well. - [app] --- themes ----- [mytheme] ------- layouts <-- to override views/layout ------- site <-- to override views/site ------- css <-- for CSS assets ------- lib <-- for library assets === Main Layout === Sample layout form: ''[app]/themes/[mytheme]/layouts/main.php'': beginPage(); ?> beginBody() ?>

TF Violet

I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively.

Footer Content

You can use rows and columns here to organize your footer content.

endBody(); ?> endPage(); ?>
Reference: [[http://www.bsourcecode.com/yiiframework2/install-new-theme-in-yiiframework-2/]] === Custom Layout for Views === Some views can have additional custom layout by simply overriding them with a new file stored in the theme. For example, to override the ''about'' view, create file ''[app]/themes/[mytheme]/site/about.php'': title = 'CUSTOM About'; $this->params['breadcrumbs'][] = $this->title; ?>

title) ?>

This is the CUSTOM ABOUT page. You may modify the following file to customize its content:

== References == * [[http://www.yiiframework.com/doc-2.0/guide-output-theming.html|Yii2 Guide: Theming]] * [[http://www.bsourcecode.com/yiiframework2/install-new-theme-in-yiiframework-2|Example of Yii2 New Theme]] * [[http://stackoverflow.com/questions/25622565/yii2-theme-integration|Yii2 Theme Integration]]