Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Page Control to swap out <body id=page> w/ <body id=home_page>?

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1899 Views
  • Todd
    Avatar
    31 Posts

    Page Control to swap out <body id=page> w/ <body id=home_page>? Link to this post

    Hi,

    I wish to create a page control (in the Includes section) that would check to see if the current page is the Home page, but I'm not sure how to go about it.

    What I need to do is very simple, I just want to switch out "<body id = "page">" with "<body id="home_page">" in my Page.ss page type.

    My guess is that I would create a page type, say PageID.ss in the Includes folder, place an if-else page control statement in the PageID.ss page, then place an "<% incude PageID%>" statement in my Page.ss file.

    The problem is that I'm not sure which page controls I need use in the PageID.ss page.

    Any help would be greatly appreciated.

    Todd

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Page Control to swap out <body id=page> w/ <body id=home_page>? Link to this post

    Im guessing you can use $URLSegment to do this which is a built in page control so you can do something like [code php]
    <body id="<% if URLSegement = home %>home_<% end_if %>page">

    Try that This page is handy for seeing some methods you can use - http://doc.silverstripe.com/doku.php?id=built-in-page-controls

  • Todd
    Avatar
    31 Posts

    Re: Page Control to swap out <body id=page> w/ <body id=home_page>? Link to this post

    Hi willr,

    I was able to do it another way, but I will try it your way as it seems much cleaner.

    Thanks for the quick response.

    Todd

    1899 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.