How to do taxonomy based css styling using template.php? I'm looking forward to implement taxonomy terms based CSS styling; especially for the body tag which I want to add the current terms. 

Here is what I have so far: 

function _phptemplate_variables($hook, $vars = array()) {
  global $node;

  switch ($hook) {
    case 'page':
      // die ('test');
      $vars['body_class'] = '';
      if (arg(0) == 'taxonomy' &amp;&amp; arg(1) == 'term' &amp;&amp; is_numeric(arg(2))) {
        $vars['body_class'] = 'theme' . arg(2);
      }
      if (arg(0) == 'node' &amp;&amp; is_numeric(arg(1))) {
        $node = node_load(arg(1));

        if (is_array($node-&gt;taxonomy)) {
          foreach ($node-&gt;taxonomy as $term) {
            $vars['body_class'] .= 'theme'.$term-&gt;tid;
          }
        }
      }

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

  return $vars; 
}


I think the code is OK, but it never get called (see my 'die' function); using simple phptemplate engine and minimal Drupal 6 install.

What obviousness am I missing here?
The reason it is not called is because hook_preprocess_variables is for Drupal 5: you should use hook template_preprocess_page in Drupal 6.

So if your theme is called "mytheme", the function would be best named "mytheme_preprocess_page" in your template.php.



Also, Drupal and the Taxonomy modules already generate many body classes, so you should check out what classes already exist because it may be that you don't need to preprocess the page at all (if all you want is to add a body class depending on taxonomy).