Drupal – Using a taxonomy term to control a section header on page.tpl.php
Wanted to store this here, I ended up not using it but I wanted to keep it in case I needed it in the future.
<!-- Get taxonomy term, ID 2 (section background image) to write out section header -->
<?php
if (arg(0) == 'node' && is_numeric(arg(1)) && !arg(2)) {
$node = node_load(arg(1));
$taxonomy_terms = $node->taxonomy;
foreach ($taxonomy_terms as $term) {
if ($term->vid == 2) {
$ld_bg = $term->name;
}
}
}
?>
<img src="/sites/all/themes/collective/img/<?php print $ld_bg; ?>_bkg.jpg" border="0" alt="<?php print $ld_bg; ?>" />
No comments yet.