Answer the question
In order to leave comments, you need to log in
How to integrate a design template (theme) in Yii2?
Now I add themes in the following way:
- I copy the theme code to the themes/views/layouts/ folder,
- I write map in config
'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@app/views' => '@app/themes/otherLayouts',
],
],
],
],
Answer the question
In order to leave comments, you need to log in
Good afternoon.
It would be better to make the structure like this:
themes/name_theme/layouts -> шаблон темы (main.php), с меню, шапкой и подвалом.
themes/name_theme/site -> виды темы
themes/name_theme/assets -> ресурсы (css, js и т.д.)
use app\assets\MyTheme;
MyTheme::register($this);
'view' => [
'theme' => [
'basePath' => '@app/themes/name_theme',
'baseUrl' => '@web/themes/name_theme',
'pathMap' => [
'@app/views' => '@app/themes/name_theme'
]
]
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question