Yii Framework Forum: render a view in a module from ANOTHER module view ? - Yii Framework Forum

Jump to content

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

render a view in a module from ANOTHER module view ? working modules with another modules : can they use direct views? Rate Topic: -----

#1 User is offline   davehere 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 19-September 10

Posted 19 September 2010 - 02:58 PM

hello, it's easy to use classes from an module in another module.
but can we acces direct view files to render them?

for example, 2 modules, contents (global) and content_text (specific) :
in content module /views/list/list_contents view must render
content_text module /views/display/_display_text view


in list_contents (contents module) I use
Yii::app()->getModule(‘content_text’); 


it works for call a class in content_text
but
$this->renderPartial(‘/display/_display_text’, array())
doesnt work (I tried different paths)

so how can I render content_text module/_display_text in contents module/list_contents?


think in advance :)
0

#2 User is offline   GSTAR 

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

Posted 19 September 2010 - 03:36 PM

How about this:

$this->renderPartial('context_text.views.display._display_text');

3

#3 User is offline   davehere 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 19-September 10

Posted 20 September 2010 - 07:00 AM

View PostGSTAR, on 19 September 2010 - 03:36 PM, said:

How about this:

$this->renderPartial('context_text.views.display._display_text');



it works good :)
think GStar!
0

#4 User is offline   zaccaria 

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

Posted 21 September 2010 - 01:11 AM

What about creating a widget?

If you have to render the same view in 2 points, maybe you will reuse even more. Maybe you can generalize a bit more and create a widget even for future.
1

#5 User is offline   davehere 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 19-September 10

Posted 23 September 2010 - 07:42 AM

hello zaccaria, yes you are right, that's what I did after, build widgets on it
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