Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

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

Go to End

3 Posts   2213 Views


31 Posts

19 October 2007 at 8:35am


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

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

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

Any help would be greatly appreciated.



Forum Moderator, 5523 Posts

19 October 2007 at 3:57pm

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 :P This page is handy for seeing some methods you can use -


31 Posts

23 October 2007 at 6:52am

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.