Yii Framework Forum: module/application nested layouts - Yii Framework Forum

Jump to content

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

module/application nested layouts Rate Topic: -----

#1 User is offline   OriginalCopy 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 13-March 09

Posted 26 February 2010 - 02:28 PM

How to use a module's layout within the application layout?

If I have:
<div>
this is views/layouts/main.php
<?php echo $content; ?>
</div>


Then when ?r=mymodule/foo/bar is called, the above $content should get the output generated by the mymodule layout:

<div>
this is modules/mymodule/views/layouts/main.php
<?php echo $content; ?>
</div>


where the above $content gets it value from modules/mymodule/views/foo/bar.php with the help of FooController::actionBar().

So note, nesting is wanted, not overwriting the global (application's) layout.

Say the modules/mymodule/controllers/FooController::actionBar() action generates the output "Hello world", the entire output should look like this:
<div>
this is views/layouts/main.php
<div>
this is modules/mymodule/views/layouts/main.php
Hello world
</div>
</div>

0

#2 User is offline   OriginalCopy 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 13-March 09

Posted 26 February 2010 - 07:53 PM

Found it, though not elegant and possibly buggy. I'll come back with the code for RFCs when I'll feel the code is stable enough.
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