do this in a view/layout where you want to have display banenr

if (Router::currentRoute()->template == '/') //Router::currentRoute()->template
actually returns the current route, defined in app/config/routes.php
{
    //print banner
}

--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/2/8 Vals <[email protected]>

> Hi,
>
> Pretty much just starting out with cake - im sure its a simple
> solution but cant get my head around it:
> I have set up my default template layout - now in my template i have a
> header and a body section, in the header I want to display an element
> "banner" but ONLY display this element on the homepage - how do I do
> this?
> I was thinking of having a separate layout which will pretty much be
> an exact copy of the default.ctp layout with the only difference being
> the addition of the banner element - then having my controller switch
> to this layout for the homepage - but isn't this breaking the DRY
> principle? If I make a small change to the default.ctp layout (add a
> new javascript file for instance), then I'd have to change the new
> layout file too (since this is pretty much an exact copy of the
> default layout file).
>
> Surely there is an easier and more efficient solution - or is my
> understanding of layouts completely off target?
>
> So pretty much ... what is the best/most efficient way to include a
> banner element in my layout but only have it displaying on the home
> page?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to