Chalist
Chalist

Reputation: 3309

YII - Render another view into component view

I have a component with comment name. this component has a view file with test.php name.

I would like to render another view file in test.php. How I can do this?

file map:

component/
  |
  comment.php
  view/
     |_
       test.php
       another.php

Upvotes: 0

Views: 1581

Answers (1)

dev1234
dev1234

Reputation: 5716

You can simply do it this way to have multiple views.

$this->render('view1', array('model' => $model));

// then, inside the view you can render a subview like this:
$this->renderPartial('view2', array('model' => $model)); 

Hope this helps you.

Upvotes: 1

Related Questions