Jump to:

3445 Posts in 1031 Topics by 872 members

Template Questions

SilverStripe Forums » Template Questions » removing footer etc from a sub-template

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1432 Views
  • Scorpiankh
    Avatar
    Community Member
    60 Posts

    removing footer etc from a sub-template Link to this post

    For a website I'm working on, the homepage needs to have a completely different layout from the rest of the site, also it has a different header and menu, and no foooter.

    I tried makin the HomePage a template extending from sitetree first but it was still including the header menu and footer from the Page page type.

    Also tried making it a subtemplate of Page and used $URLSegemnt in the <body> tag to create a page id so I could try and remove or make the items display differently in the css file, which half worked, checking the source code once the page had been generated it was showing the homepage with <body id="home"> but none of my #home css styles were being applied to the page.

    So is there a way to either make the HomePage page type not inherit from the Page page type, or to remove the header menu and footer in the template?

    The only other way i can think of to do it at the mo is to leave the Page page type blank inside the body tags and include the header footer and menu individually on each sub-template except the HomePage.

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: removing footer etc from a sub-template Link to this post

    You are probably using a HomePage sub template (eg a HomePage.ss inside yourtheme/templates/Layout/.) this means that the template parser will use Page.ss in yourtheme/templates which has the header / footer. What you want to do is define HomePage.ss as a root template (in yourtheme/templates/ rather than a subtemplate. Then Page.ss will not be used at all.

    Other option is to wrap your header / footer in Page.ss with <% if URLSegment != home %>...

  • Scorpiankh
    Avatar
    Community Member
    60 Posts

    Re: removing footer etc from a sub-template Link to this post

    Ok I tried again making the HomePage a template in /templates/ folder and it worked this time, not sure what I did wrong before, i don't think I had it in the Layout folder before ... but anyways, working now so all good thanks

    1432 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.