Page 1 of 1

How can I add an ID to the body tag per page?

Posted: Sun Oct 01, 2006 10:35 am
by stinhambo
I use custom CSS rules to highlight a menu depending on which page I'm on based on the BODY ID and LI CLASS.

Is there a way of defining a body id and class via the CMS or do I have to create a seperate template for each page to achieve this?

Re: How can I add an ID to the body tag per page?

Posted: Sun Oct 01, 2006 12:06 pm
by tsw
in your template

Code: Select all

</__body id="page{$page_id}">
hope this helps

btw, you can use {get_template_vars} to check what variables are usable on a page...

Re: How can I add an ID to the body tag per page?

Posted: Sun Oct 01, 2006 1:06 pm
by stinhambo
I used -



in the end.

It seems to work at the moment for me :)

Re: How can I add an ID to the body tag per page?

Posted: Sun Oct 01, 2006 1:38 pm
by tsw
works also, but isnt automagick ;)

Re: How can I add an ID to the body tag per page?

Posted: Sun Oct 01, 2006 3:25 pm
by stinhambo
What do I do with {get_template_vars}?

Yes I see what the previous hint does. I might have to go with it as I need to insert an ID and a class into the Body tag.

Re: How can I add an ID to the body tag per page?

Posted: Sun Oct 01, 2006 5:27 pm
by tsw
with {get_template_vars} you can check what variables are present in that page.

you can use all those variables as you like just like {$sitename} and so on