To give an example of majna's comment.

If you have your base layout called default and another one called
contained...

in contained.ctp:
echo $this->renderLayout('<div id="container">'.$content_for_layout.'</
div>','default');

This would probably be the smallest layout in history but I hope you
get the point. Usually I will pull all the html into a string and pass
that. Either using heredoc or just a really long "normal" string.

Martin



On Apr 20, 12:12 pm, majna <[email protected]> wrote:
> check out View::renderLayout()
>
> On Apr 17, 4:43 pm, maxmil <[email protected]> wrote:
>
> > I would like to be able to define a kind of inheritance model for my
> > layouts. Thats to say be able to define a layout for a layout.
>
> > Probably not very well explained, heres a concrete example.
>
> > I have a generic layout for my application but in a group of pages i
> > need to add a panel to this layout. I have 3 options:
>
> > 1) Add the panel to every page that needs it. This can be done
> > relatively cleanly using an element but if it were not a solid block
> > of html but a series of small blocks this is not ideal.
> > 2) Create a new layout with everything that the default layout has
> > plus the panel. This is not ideal because it duplicates the code in
> > the default layout.
> > 3) Set some view variables that cause the default layout to display or
> > hide the panel. This is ok but if i end up having many different
> > variations of the layout can make my default template complicated and
> > full of logic rather than simple markup.
>
> > What i would really like would be to define a layout that inherits the
> > contents of another layout and adds its content to the
> > $content_for_layout variable.
>
> > I don't think that this is possible, am i wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to