kelly johnson
kelly johnson

Reputation: 1636

changing body classes based on page tpl.php template

I haven't quite the right process to change the body classes based on the page being viewed.

I have about 20 or so pages within a subsection that all have a different background color and reversed nav links from the main site.

I can't figure out if there is some kind of preprocess function to use (and which) in template.php or if I should do something specifically in the certain xx-page.tpl.php file.

Just adding an ID to the body tag in the xx-page.tpl.php isn't reliable due to browser caching.

I've seen this snippet:

if (drupal_is_front_page()) {
 $vars['body_class'] .= ' home';
 }

however, "is it the front or not" isn't enough because it's also not just a page, it's a specific page but I've either missed the syntax or am doing something wrong.

Is this a case where I need to create a custom function and if so, is the template.php page where it goes?

also, I'm in Drupal 6.26

Thanks

Upvotes: 1

Views: 620

Answers (1)

Greg
Greg

Reputation: 748

Are you looking for this function? http://api.drupal.org/api/drupal/includes!theme.inc/function/template_preprocess_page/6

You might also want to have a look at the Context module.

Upvotes: 1

Related Questions