A quick and dirty way is to simply put a switch in the pages
controller based on the $page variable. I have done something like
this on some projects when required :
Within PagesController::Display
$page = null;
$subpage = null;
$page_current = null;
if (!empty($path[0])) {
$page = $path[0];
$page_current = $page;
}
if (!empty($path[1])) {
$subpage = $path[1];
$page_current = $subpage;
}
$this->_changeLayout($page_current);
Within PagesController::_changeLayout($page)
function _changeLayout($page)
{
switch ($page)
{
case 'home':
$this->layout = 'home';
break;
case 'about':
$this->layout = 'about';
break;
default:
$this->layout = 'default';
break;
break;
}
}
There are much better ways of doing this but it is a place to start.
Cheers,
mikee
On 17/01/07, tracyfloyd <[EMAIL PROTECTED]> wrote:
I have several static pages that are served up using the pages
controller and I'd like to have different layouts... say a different
layout for the home.thtml and about.thtml. I'm guessing I need to add
some logic on the pages controller but am not sure how to go about
this... any ideas... or is there a better way?
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---