Yii Framework Forum: rendering views of other modules/controllers - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

rendering views of other modules/controllers Rate Topic: -----

#1 User is offline   Nayjest 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 85
  • Joined: 05-June 10
  • Location:Ukraine, Kiev

Posted 22 October 2010 - 05:26 AM

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?
Web-superman. My blog about web development (russian).
0

#2 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 22 October 2010 - 05:59 AM

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

Anyway you can check this post.
0

#3 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,003
  • Joined: 30-October 09
  • Location:UK

Posted 22 October 2010 - 09:25 AM

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
2

#4 User is offline   Manish Gupta 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 09-October 13

Posted 30 October 2013 - 06:19 AM

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.
0

#5 User is offline   Arockia Johnson 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 89
  • Joined: 25-June 13

Posted 30 October 2013 - 08:36 AM

Hi,

You can use the following function tooo

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




Cheers!
Thanks & Regards,
S.Arockia Johnson
www.arojohnson.tk
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users