Include another view with related controller in main view

Good morning. I’m new in the Yii world. I’m working with a completed project and I have to create a similar site from this project.

I have two particular Controllers with related Views:

SiteController (Controller) with index.php (View) and CatalogController (Controller) with books.php (View).

With CatalogController I use also use 4-5 views (collane.php, cedole.php, book.php, _filter.php)

This is the situation:

I have homepage and a navbar o the top

When I click on Catalog in a navbar, it shows the layout catalog.php and the view books.php (defaultAction).

In this page I have three buttons: Cedole, Collane, Catalogo. If I click on one of this button, it shows me related content.

I would like to import in index.php the same behavior presents in Catalog.

So, when I open my site, i would like to have my normal homepage (the same of the previous), but I would like to have in this page, the content of the Catalog, with the same actions.

Could you help me?

Thank you very much

I’d create a widget with content of the Catalog, so it will be reusable everywhere.

Otherwise you can think to render the content with renderPartial

1 Like

If I use renderPartial, can I interact in the same way? Do I have to write renderPartial in the main controller (SiteController)?

In my main controller I have just this in the actionIndex:

return $this->render(‘index’);

Do I have insert here the renderPartial?

Thank you again!