Yii Framework Forum: Nested layouts... - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Nested layouts... Rate Topic: -----

#1 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 10 October 2008 - 04:38 PM

... are possible in Yii?

Thanks :-)
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,895
  • Joined: 04-October 08
  • Location:DC, USA

Posted 10 October 2008 - 04:45 PM

Yes. Assume you have a view which uses layout A that is nested in another layout B. When rendering the view, you should set its layout to be A. Inside A, you use the following:

<?php $this->beginContent('/path/to/layoutB'); ?>
stuff for layout A
<?php echo $content; ?> this is from the view
stuff for layout A
<?php $this->endContent(); ?>


In layout B, you just need to echo $content to display content of layout A.
0

#3 User is offline   notzippy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 06-October 08

Posted 15 October 2008 - 12:54 PM

I tried this and was not able to get it to work

<?php $this->beginContent('/testview',array()) ;  ?>
  Start <?php echo "aa".$content;  ?> End
<?php $this->endContent();  ?>


no matter what I place between "beginContent" & "endContent" it always only shows the "testview".

Thoughts ?
NZ
0

#4 User is offline   notzippy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 06-October 08

Posted 15 October 2008 - 12:59 PM

Sorry got the view layer mixed up, the "testview" need the "echo $content" not the parent
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

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