Views: Including multiple views in one view

I developed an application with different MVC using Yii Framework

for instance

I created a broken contact layer for students and undergraduate courses, etc.

Everything worked perfectly, since each of them had its own menu, and each time it was pressed, its own view was displayed.

Now my client wants everything on one page and is pretty persistent, we are talking about 7 MVCs that should be displayed on one page. Each MVC has its own controller, model and view, as well as its own DB table. How can I display them all on one page without re-recording the entire application? Is it possible.

+4
source share
2 answers

If I understand your problem correctly, you just want to combine all the menu items and show full navigation on each page.

By dividing the menu into separate views and including each of them in the navigation view, you can have a well-structured, non-repeating code.

$this->renderPartial('anotherView'); 

- This is almost everything you may need to get started. This is only allowed in views, since $this refers to the current controller object.

+6
source

You can use the views of other controllers:

$ this-> renderPartial ('application.views.student_Contact.show', array ('model' => $ model));

Hope this helps.

+3
source

All Articles