Once you´re comfortable switching layout like that, you could then do
this dynamically in the beforeFilter of your controllers.
For example, check if a layout exists with a name corresponding to
this controller & action, and if not, check for one for this
controller, then as a last resort use the default one.
On Apr 21, 1:06 am, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> function one() {
> $this->layout = "layout1";
>
> }
>
> function two () {
> $this->layout = 'layout2';
>
> }
>
> then in your views/layouts you have 'layout1.thtml' and
> 'layout2.thtml' (or .ctp if you are risking 1.2 which if you are just
> getting started with php again and cake DON'T you'll just make life
> more difficult and make Nate and Gwoo grumpy)
>
> On 4/20/07, andyreimer <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
>
> > I've tried searching this group and haven't found anything quite
> > specific enough for me. Admitedly I'm getting back into PHP in
> > general after a break of a few years, so I could be missing the
> > obvious.
>
> > Question: On page 52 of the manual it states that you can switch
> > between views in your controllers using the $layout variable or the
> > setLayout() function. If I want to change the layout based on the
> > action a controller takes, I assume I would use the setLayout()
> > function but it would help to see an example of this. Using the
> > variable makes it quite easy to set different layouts for each
> > controller, but I'm looking to switch layouts within the same
> > controller.
>
> --
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot
>
> http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/- Hide
> quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---