Jesse,
The underlying assumption with Cake layouts is that they are all-
encompassing, unlike Java Struts "tiles", for example, where you have
a master tile layout and various pieces that are included and shared
between layouts.
Of course there are case (like yours) where you are presented with a
complex layout where sharing between layouts would be nice. But, it's
not really a great idea in my opinion. When I run across a case like
this in my own Cake apps I just fork the layout and then switch to it
in the controller as appropriate. That way the one-file layout remains
intact.
You *could* use elements if you wanted to, but you'd have to pass the
layout variables to the element manually, like this:
<?php echo $this->renderElement('head', array('title_for_layout' =>
$title_for_layout)); ?>
That isn't ideal, but it works.
On Nov 18, 2:47 pm, Jesse <[email protected]> wrote:
> I'm having alayoutissue and I'm not sure how to solve it.
>
> Problem:
>
> I have a defaultlayoutthat contains my general header and footer
> information. There are two sections of my website that run coupons.
> Let's call them Section A and Section B. These sections need to
> include the header and footer that the default site uses, but then
> also append a secondary header for visual effect. Its' almost as if
> there was alayoutwrapped inside of anotherlayout.
>
> The secondary header info that needs to be passed for Section A and
> Section B is different. It mainly includes some images, text and a
> couple stylesheets that differ it from the defaultlayout. The easy
> way to do this would be to have 3 layouts, but the three layouts will
> almost be identical except for a couple element calls and style
> sheets.
>
> Solution:
> My first solution I see would be to "wrap alayoutin anotherlayout".
> I don't think this is possible but makes sense in my head.
>
> My second solution was to create a template header and template footer
> element that includes the header and footer info from the defaultlayout, and
> just call these at the top and bottom of the Section A and
> Section B layouts. The problem with this is that the header element
> will not recognize the "$title_for_layout" or "$script_for_layout"
> variables (both of which I use a lot).
>
> Any other suggestions?
--
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=.