Displaying a taxonomy term description at the top of a Drupal view
In Drupal, you can provide a description for each term in a taxonomy vocabulary. The default taxonomy term pages of Drupal 6 include the description at the top of each page (if only one term is present). Here's how you can achieve the same thing when using views.
- Make sure your theme has a page.tpl.php file. My theme is a subtheme of Zen so I copied the page.tpl.php file from the zen folder into my theme's folder.
- Create a duplicate of your theme's page.tpl.php file and call it page-taxonomy.tpl.php.
- Edit the new page-taxonomy.tpl.php file and add the following where you want the description to appear (for example at the end of the content-header):
<?php if ($taxonomy_term_description): ?>
<div id="taxonomy-term-description">
<?php print $taxonomy_term_description; ?>
</div>
<?php endif; ?> - Edit your theme's template.php file and add the following function:
function yourtheme_preprocess_page(&$vars, $hook) {
$term = taxonomy_get_term(arg(2));
$vars['taxonomy_term_description'] = filter_xss_admin($term->description);
}
After you clear your theme registry - by visting the admin/build/modules page - the term description will be displayed at the top of the page showing your taxonomy_term view.
Original Article: