WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: markywatts on June 19, 2009, 11:48:41 AM

Title: Current page ID/Class in body tag
Post by: markywatts on June 19, 2009, 11:48:41 AM
Hi,

I need to set an ID or Class in the say the body tag, that identifies what page you are on.  So I can then apply some css thats specific to that page.  What code do I add to the template?

Thanks
Marky
Title: Re: Current page ID/Class in body tag
Post by: Stefek on June 19, 2009, 12:13:38 PM
Hello,

use:

<body id="<?php echo $page_id; ?>">

Regards,
Stefek
Title: Re: Current page ID/Class in body tag
Post by: BerndJM on June 20, 2009, 01:12:11 AM
Sorry Stefek,
but numeric id's are not allowed.
Specially the IE may show some strange behavior if a id starts with a number.
So
Code: [Select]
<body id="p<?php echo $page_id?>">would be the better way.

Regards Bernd
Title: Re: Current page ID/Class in body tag
Post by: Stefek on June 20, 2009, 12:57:07 PM
Of course, Bernd - you're right.

You have to use a prefix beforehand.
It's because CSS won't allow numbers at the beginning of the class/id.

Regards,
Stefek


Title: Re: Current page ID/Class in body tag
Post by: markywatts on June 23, 2009, 07:37:35 AM
Brilliant thanks! works like a dream.
Cheers
Marky