WebsiteBaker Support (2.8.x) > Templates, Menus & Design

Current page ID/Class in body tag

(1/1)

markywatts:
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

Stefek:
Hello,

use:

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

Regards,
Stefek

BerndJM:
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: ---<body id="p<?php echo $page_id; ?>">
--- End code ---
would be the better way.

Regards Bernd

Stefek:
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


markywatts:
Brilliant thanks! works like a dream.
Cheers
Marky

Navigation

[0] Message Index

Go to full version