Yii Framework Forum: How to render an application view from a module's view - Yii Framework Forum

Jump to content

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

How to render an application view from a module's view Rate Topic: -----

#1 User is offline   Saulo Vallory 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 16-September 11

Posted 23 September 2011 - 11:53 AM

Hey guys,

I'm new to the framework, but I'm really excited. Even extended an extension (github.com/svallory/giix-haml).
Now, I'm trying to render an application view (/protected/views/_menu.php) from a view inside a module (/protected/modules/rights/views/layouts/main.php) but I can't get it to work. So far, I've tried:

$this->renderPartial('/_menu');

$this->renderPartial('//_menu');

$this->renderPartial('application.views._menu');


and many more...

The only work around I could find was to create a symbolic link to the application view inside de module, but it relies on apache configuration.

How could I accomplish this?
0

#2 User is offline   dckurushin 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 392
  • Joined: 16-March 11
  • Location:Israel

Posted 23 September 2011 - 12:06 PM

maybe //// would help...
0

#3 User is offline   dckurushin 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 392
  • Joined: 16-March 11
  • Location:Israel

Posted 23 September 2011 - 12:19 PM

I did a little test for you...
If you put _test.php like this: /view/_test.php

You can access it from template inside layout or from some page inside /site/index.php etc.

Or from the controller just by

<?php $this->renderPartial('//_test');?>

0

#4 User is offline   Saulo Vallory 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 16-September 11

Posted 23 September 2011 - 12:23 PM

Got it!

The correct syntax is actually the one i've found previously googling

$this->renderPartial('//_menu');


The problem was with the phamlp extension. On my application layout I had

$this->renderPartial('/_menu');


Which works fine with the default ViewRenderer but doesn't work with the phamlp view renderer
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