Answer the question
In order to leave comments, you need to log in
Is it possible to use nested templates inside views in Yii2?
The Russian-language documentation only states that nested templates are used inside templates.
Sometimes you need to nest one template within another.
Using the approach above, you can nest templates in multiple levels.
<?php
// Файл вида @app/views/design/index.php
/* @var $this yii\web\View */
?>
TEST: begin<br>
<?php $this->beginContent('@app/views/design/file.php') ?>
It's content!
<?php $this->endContent() ?>
TEST: end<br>
Answer the question
In order to leave comments, you need to log in
What for? There are blocks www.yiiframework.com/doc-2.0/yii-widgets-block.html
There are widgets.
Goodnight.
Of course you can. Use one main template, customize your menus in plug-ins.
For example, splitting the template for different rbac access levels. There is one menu for the admin, another for the moderator, and you leave the general code in the main template.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question