V
V
Vladimir Golubev2015-06-10 22:15:14
Yii
Vladimir Golubev, 2015-06-10 22:15:14

How to organize nested views in Yii2? Or make the template polymorphic?

In Yii2, it is quite convenient to set a template and render views. But how to make a more complex organization is not clear.
The goal is this - when forming a page, you need to generate standard pages with a template, and add a block that can vary depending on sections or any factors. I have two methods in my head - either make a nested organization of views (insert several different view blocks into the template like a blade in laravel), or make the template manageable so that certain blocks are generated in it as needed.
The idea that such functionality is already implemented in the framework does not leave me, I'm just looking in the wrong place. Has anyone implemented such a scheme? Share your experience?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
matperez, 2015-06-11
@wladyspb

www.yiiframework.com/doc-2.0/guide-structure-views...

V
Vit, 2015-06-10
@fornit1917

If I understand you correctly, then you need widgets.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question