A
A
Alexander Ampleev2018-08-22 09:14:30
Yii
Alexander Ampleev, 2018-08-22 09:14:30

How to use subview in Yii2 view?

Here I have a layout, views are substituted inside it. But how to use the same view inside these views? Now in several places the same block has to be edited statically, but I want to fix it in one view and the block has changed everywhere

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2018-08-22
@Ampleev

1. Move such code to the Widget
2. Use the render method of the View object. those. in the view file just
$this->render('path/file.php')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question