Answer the question
In order to leave comments, you need to log in
How to organize page templates in yii2?
How to organize page templates in yii2?
Let me explain
, for example, I want to organize
- the main page
template - the category page template
- the rest of the pages
template By templates I mean the outer wrapper
<html>
<head>...</head>
<body>...</body>
</html>
'/' => 'main.layout',
'/cat/' => 'cat.layout',
'default' => 'other.layout' //(в данном случае default - это не url, а некое зарезервированное слово)
Answer the question
In order to leave comments, you need to log in
You can add a line to the beginning of the actionIndex() function of the SiteController object $this->layout = '@app/views/layouts/index.php';
and now layout index.php will be used for the main one. Similar logic can be applied in other cases (if I understand your question correctly).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question