I want to attach a different CSS style to a node, basing on the node publishing date or some PHP properties.
What would be the best way to do this?
Attach different CSS styles on a node basing on publishing date or other PHP properties
You are asking the wrong question. The question you should have asked is "how do I add a class on a node depending on some properties?". Using different set of CSS files to control styling a an element is just a no-no.
The answer to the correct question depends on whether you are targeting Drupal 6 or Drupal 7:
- On Drupal 6, you will generally have to implement the logic your own node template;
- On Drupal 7 (or on Drupal 6 if you are using an intelligent base theme like Zen), you would implement a
hook_preprocess_node()in your theme and add classes to the
I agree about the
hook_preprocess_nodebusiness. May 4, 2011 at 13:36
You're right. I meant to say class. I'm using d6 so I guess i will have to just implement it on the template file May 5, 2011 at 1:34
Create a module, then in the
do your php calculations and include css with
and js with