Commit e75e233d by Alexander Makarov

Added example about configuring theme runtime

parent fa0a3aef
...@@ -38,6 +38,17 @@ For example, with a configuration above a themed version of a view file `@app/vi ...@@ -38,6 +38,17 @@ For example, with a configuration above a themed version of a view file `@app/vi
`@app/themes/basic/site/index.php`. It basically replaces `@app/views` in `@app/views/site/index.php` with `@app/themes/basic/site/index.php`. It basically replaces `@app/views` in `@app/views/site/index.php` with
`@app/themes/basic`. `@app/themes/basic`.
In order to configure theme runtime you can use the following code before rendering a view. Typically it will be
placed in controller:
```php
$this->getView()->theme = Yii::createObject([
'class' => '\yii\base\Theme',
'pathMap' => ['@app/views' => '@app/themes/basic'],
'baseUrl' => '@web/themes/basic',
]);
```
### Theming modules ### Theming modules
In order to theme modules, `pathMap` may look like the following: In order to theme modules, `pathMap` may look like the following:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment