Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Vipin Semwal

Renderpartial View From Module To Main Directory

Recommended Posts

I want to renderPartial a view from modules.

 

Path of View thats need to renderPartial: protected/modules/shop/views/products/addToCart.php

 

Path where to be Rendered: protected/views/site/_post.php.

Share this post


Link to post
Share on other sites

You need to do this:

 

1. Load the module (main.php):

 

'modules'=>array(

'shop',)

 

2. autoloading model and component classes of the modules:

 

'application.modules.shop.models.*',

'application.modules.shop.components.*',

 

3. You will need to pass the model and others necessary data to the view (if required):

 

$mymodel = new NewModel;

$data['someData'] = 'Data';

echo $this->renderPartial('shop.views.products.addToCart', array('model'=>$mymodel,'data'=>$data));

 

I have same issue and I soled in this way in my application and its working.

  • Upvote 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...