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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

problem in using $URLSegment


Go to End


2 Posts   1451 Views

Avatar
ojalà

Community Member, 87 Posts

16 October 2008 at 5:23am

HI!
I read some topic in forum and I understand that to change some part of theme in a new page type like Headero footer I must use this variable.
So in my tutorial/layout/NewTypePage.ss I write

<body id="$URLSegment">
</body>

and in the css in themes/css

#segment1 #Header{
background-color:#FFFFFF;
}

How I must replace instead of segment1?

Avatar
Willr

Forum Moderator, 5523 Posts

16 October 2008 at 6:17pm

Segment 1 would be the url of your page. Eg on the 'home/' page you would have <body id="home"> on the 'services/' page you would have <body id="services"> etc then in the css you would have to do #services or #home