Add Descriptive Text at the Top of Taxonomy-Generated Pages
The taxonomy module automatically generates a page for each taxonomy term that lists all the nodes tagged with that term. The URLs of these pages are in the format of http://example.com/taxonomy/term/.
By default, this page only shows the term name as the title and the teaser view of each node (as displayed below).

Sometimes you may want to display a short explanation or heading at the top of the page. This is possible by modifying the theme to display the vocabulary description and/or term description. The code below adds both the vocabulary description (if it exists) and the term description (if it exists) to the top of each taxonomy page. The result would be something like this:

First, create some phptemplate variables in your theme template.php. (Keep in mind, you'll probably have more code in the _phptemplate_variables function, but this specifically highlights the code that is applicable to this solution.)
<?php
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
if (arg(0) == 'taxonomy') { //check to see if this is a taxonomy page
$vars['term_description'] = ''; //create a new template variable
$vars['vocab_description'] = ''; //create a new template variable
$a2 = arg(2); //get the term id
if(is_numeric($a2)) {
$result = db_query(db_rewrite_sql("SELECT vid, description FROM {term_data} td WHERE td.tid = %d"), $a2);
$this_term = db_fetch_object($result);
//save the term description
$vars['term_description'] = $this_term->description;
$vocab_result = db_query(db_rewrite_sql("SELECT description FROM {vocabulary} WHERE vid = %d LIMIT 1"), $this_term->vid);
$this_vocab = db_fetch_object($vocab_result);
//save the vocabulary description
$vars['vocab_description'] = $this_vocab->description;
}
}
break;
}
return $vars;
}
?>Then, create a new template file in your theme by copying page.tpl.php and naming the copy 'page-taxonomy.tpl.php'. Note: Drupal 5 will automatically recognize template files with this naming convention.
In your new template file, add the following lines to call and display the term description (probably above print $content):
<?php if (!empty($vocab_description)) { ?>
<div id="vocab-description"><?php print $vocab_description; ?></div>
<?php } ?>
<?php if (!empty($term_description)) { ?>
<div id="term-description"><?php print $term_description; ?></div>
<?php } ?>Note: you only need to print the $term_description variable. The HTML surrounding it is optional.
