By tarmo on
I would like to detect certain taxonomy term inside page.tpl.php.
Like:
if (node has the "term")
do something
endif
Thank you in advance
I would like to detect certain taxonomy term inside page.tpl.php.
Like:
if (node has the "term")
do something
endif
Thank you in advance
Comments
In...
page.tpl.php or node.tpl.php?
I dont know. I think,
I dont know. I think, note.tpl.php is okay also.
Understand
This is very elementary stuff, you need to know what you're talking about. Page is the template for the whole page, node is the template for the content, to put it simply. It's a bit confusing since a page is also a node type, just like story or blog but the page template you refer to is a template to lay out the whole page, with logo, primary links, side blocks, etc.
For each node type you can have a node template and within each template it's pretty easy to sort through the terms. $node->taxonomy is an array with terms, you can check for the vid (vocabulary id), tid (term id) or name you're looking for. Search the docs and forum for changing your node.tpl. But you need to understand what you're doing.