1

Im building a web page with multiple sub-portals, which should all have slightly different css styles. Is it possible to add a certain css file depending on the taxonomy of a node? With drupal_add_css maybe? Im using Drupal 6.

Thanks, Max

1 Answer 1

1

If you want to load certain CSS files based on taxonomy, maybe you could name your files according to taxonomy vocabularies. Just build the file name based on the vocabulary of a term.

$file = 'mymodule_taxonomy_' . $vocabulary . '.css'; drupal_add_css(drupal_get_path('module', 'mymodule') . '/' . $file); 

If you have a node object you can use taxonomy_node_get_terms() to get the terms for a node and use this code to load a proper CSS file. Then, with a vocabulary named cars you can name a CSS file mymodule_taxonomy_cars.css. That file can be loaded according to a vocabulary.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.