rendering views of other modules/controllers

It’s not good, that i can not render view from other module/controllers using render()/renderPartial() methods.

As i understand, the only way is using renderFile && manual adding layout.

Or i can?

The best solution is avoiding doing it, and creating a widget instead.

Anyway you can check this post.

Try it like this:


<?php $this->renderPartial('admin.views.enquiry._view', array('model'=>$model)); ?>

Use dot notation, in this example:

admin = module

views = views directory

enquiry = model

_view = view file

This is mostly for future visitors:

You can check out Larry Ullman’s Guide.

Basically, we can use:




<?php echo $this->renderPartial('//search/_form'); ?>



Where _form is a view from a different module search.

Hi,

You can use the following function tooo


Yii::app()->runController('your-controller/your-action'); // In view file itself you can use. 

Cheers!

my five cents:


$this->render('../controller/viewfile');

controller = controller name

for example "site"

viewfile = view script

for example "index"

Actually -form is in the app.views.search dir because of the ‘//’ in front.

GSTAR actually has it right