I want to be able to theme any node except in a different way depending on the content. Imagine - a red background for an excerpt if it's marked as critical using taxonomy.
I've got the node.tpl doing the right thing. It applies differnet CSS depending on the content.
Now need to share some information between a snippet of php code in a page which creates a list of particular nodes, and the node.tpl.php which themes them. At the moment it looks like the code to run embedded PHP is isolated from the rest of the code, so that you can't overwrite variables. This stops you passing info into and out of the embedded script.
I could alter the way my Drupal works, perhaps making $vars available in the embedded code. But I'm wondering if there's already a way of doing this that I'm missing. Any hints, experts?
Thanks,
Jeff
Comments
maybe a simple solution
you want different styles for your
nodes ?
its possible by using template.php all alone
ill give you an example php code
this example gives you the opportunity to change
layout for a node (or page, just reproduce it for the page hook) and
.css
delete the one you dont need
in your case, you won't check for "is_front" but for other cases, id dont know if you can get your php logic inside the template file over to the template.php, but if the style is depending on things like
...odd and even count of nodes ?
...the $node->content
...etc.
you could make it my way
important note -> i typed it fast maybe i missed some brackets
-micha
work in progress with Drupal 4.6: langmi.de