Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Views: Including multiple views in one view

Tags:

php

yii

I developed an application with different MVCs using the Yii Framework

For example

I created a crud layer for Student Contact details and Student Courses etc.

All worked perfectly since each had its own menu, and when clicked eachs own view rendered.

Now my client wants everything on one page, and is quite persistent, we are talking about 7 MVC that need to be displayed on one page. Each MVC has it's own controller, model and view and own DB table. How can I render all of them on one page without re-writing the whole application? Is this possible.

like image 929
Elitmiar Avatar asked Jan 23 '23 02:01

Elitmiar


1 Answers

If I understood your problem correctly, you simply want to merge all menu items and show the full navigation on each page.

By separating menus into standalone views and including each and one of them into a navigation view, you can have a well-structured non-repeating code.

$this->renderPartial('anotherView');

is pretty much everything you might need to know to get started. This is only callable in views as $this refers to the current controller object.

like image 58
pestaa Avatar answered Feb 01 '23 13:02

pestaa