making pagelayout.tpl adjust for specific pages

Author Message

William Gourlie

Friday 07 May 2004 2:24:12 pm

For my first ez publish site, I've decided to convert my current company website into an ez publish site. Been pretty easy so far, got a front page working and a news page, but I am having a problem converting one aspect of the website. The original site had an image that would run down the side of the page displaying the page name, for example "Home", "About Us" or "Services". This portion of the html is located within the pagelayout.tpl. Now, obviously every page uses the pagelayout.tpl for the main layout, so if the pagelayout.tpl uses the "Home" image, every page will have the "Home" image. I've thought about using a template override for each section on the site, but quickly came to the conclusion that it would defeat one of the great aspects of templates, changing the one file and having it reflect on every page. ANYWAY, theres gotta be a better way to do it, but I really have no idea how. If someone could point me in the right direction it would be greatly appreciated.

Thanks,

Brian

Vivek Chopra

Friday 07 May 2004 2:43:30 pm

Brian,

Create sections for "Home", "About Us", "Services" and all other parts of the website and then use a case statement in pagelayout.tpl to check the section and display the correct image name. You can get the section in your pagelayout.tpl through $DesignKeys:used.section

I hope this helps. I am also on my first ezpublish site.

Vivek

William Gourlie

Friday 07 May 2004 3:20:05 pm

Very much appreciated. Good luck on your site!

-Brian

Conor Murray

Monday 10 May 2004 5:50:59 am

Here's an easy way to work around your problem... use pagelayout.tpl for every page EXCEPT the home page and override it for the home page. The home page is node 2 by default.

You can also embed code in your pagelayout.tpl to display different images etc. in different sections of the site, like this:

{let cursect=$module_result.section_id}
{switch name=sw1 match=$cursect}
  {case match=3}
    <img src={"pict_camp.jpg"|ezimage} alt="picture" width="160" height="147" />
  {/case}
  {case match=4}
    <img src={"pict_hre.jpg"|ezimage} alt="picture" width="160" height="147" />
  {/case}
  {case match=5}
    <img src={"pict_youth.jpg"|ezimage} alt="picture" width="160" height="147" />
  {/case}
...
  {case}
    <img src={"pict_search.jpg"|ezimage} alt="picture" width="160" height="147" />
  {/case}
{/switch}
...
{/let}

The 'case' without 'match' is the default case.

HTH,
Conor Murray

Language is a virus - William S Burroughs

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.