Sometimes you'll want to create a conditional statement based on the taxonomy term assigned to the node.
This is the statement you'll start with:
<?php
$categories = taxonomy_node_get_terms($node->nid); $a = arg(1);
$categories = taxonomy_node_get_terms($a);
foreach ($categories as $category) {
$columnid .= $category->tid;
}
?>
$columnid can be called whatever you like, and its what you'll use in your conditional statement.
Here are two examples. Showing nothing for nodes with NO terms (in page.tpl.php). In this case, I've used $rescat instead of $columnid.
<?php
$categories = taxonomy_node_get_terms($node- >nid);
$a = arg(1);
$categories = taxonomy_node_get_terms($a);
foreach ($categories as $category) {
$rescat .= $category->tid;
}
?>
<?php if ($rescat == '') {
} else { ?>
<div id="mag-nav">
<?php print $resource_nav; ?>
</div>
<?php } ?> Showing something different for each Term
<?php
$categories = taxonomy_node_get_terms($node->nid); $a = arg(1);
$categories = taxonomy_node_get_terms($a);
foreach ($categories as $category) {
$columnid .= $category->tid;
}
?><?php if ($columnid == '1') { ?>
<a href="/rss/first" class="rss">Subscribe to the First feed</a>
<?php } else if ($columnid == '2') { ?>
<a href="/rss/second" class="rss">Subscribe to the Second feed</a>
<?php } else if ($columnid == '3') { ?>
<a href="/rss/third" class="rss">Subscribe to the Third feed</a><?php } else { ?>
<a href="/rss/general" class="rss">Subscribe to the General feed</a><?php } ?>