themes

Theme specific nodes

Question: 
How to set-up a theme for a specific node?

Under your theme directory create a file named:

page-node-nodeID.tpl.php

For example a node with node ID of 78 would have a page style named:

page-node-78.tpl.php

Taxonomy terms in contemplate template.

Question: 
How to print taxonomy terms within a contemplate template.

Enter the following within your customised template.


<?
$taxonomy_terms = $node->taxonomy;
  foreach ($taxonomy_terms as $term) {
    $faq_tags .= ", $term->name";
  }
$faq_tags = substr($faq_tags,1);
?>

The variable $faq_tags is now available listing the terms separated by commas.

Taxonomy terms in page.tpl.php

Question: 
How to make taxonomy terms availble to template.tpl.php

Within your page.tpl.php file enter the following:

if (arg(0) == 'node' && is_numeric(arg(1)) && !arg(2)) {
$node = node_load(arg(1));
$taxonomy_terms = $node->taxonomy;
foreach ($taxonomy_terms as $term) {
$faq_tags .= ", $term->name";
}
}
$faq_tags = substr($faq_tags,1);

print $faq_tags;

Taxonomy terms in page.tpl.php

Question: 
How to make taxonomy terms availble to template.tpl.php using template.php

function YourThemeName_preprocess_page(&$variables) {
  foreach($variables['node']->taxonomy AS $tax_term) {
    $variables['wowzers'] .= ", $tax_term->name";
  }
  $variables['wowzers'] = substr($variables['wowzers'],1);
}

After entering this in your template.php file the variable $wowzers will be availble for use within your page.tpl.php file.

Please note you can only use one preprocess function per template.tpl.php file.

Drupal logo template tpl php

Question: 
How to embed a logo within the Druapl template.tpl.php file?

An example is shown below:


<div id="logo">
<?
if ($logo): ?>
<a href="<? print $base_path; ?>" title="<? print t('Click to return to the Homepage'); ?>"><img src="<? print $logo; ?>" alt="<? print t('Click to return to the Homepage '); ?>" /></a>
<? endif; ?>
</div>