Skip navigation
Help

taxonomy-term.tpl.php

  1. drupal
    1. 7 drupal/modules/taxonomy/taxonomy-term.tpl.php

Default theme implementation to display a term.

Available variables:

  • $name: the (sanitized) name of the term.
  • $content: An array of items for the content of the term (fields and description). Use render($content) to print them all, or print a subset such as render($content['field_example']). Use hide($content['field_example']) to temporarily suppress the printing of a given element.
  • $term_url: Direct url of the current term.
  • $term_name: Name of the current term.
  • $classes: String of classes that can be used to style contextually through CSS. It can be manipulated through the variable $classes_array from preprocess functions. The default values can be one or more of the following:

    • taxonomy-term: The current template type, i.e., "theming hook".
    • vocabulary-[vocabulary-name]: The vocabulary to which the term belongs to. For example, if the term is a "Tag" it would result in "vocabulary-tag".

Other variables:

  • $term: Full term object. Contains data that may not be safe.
  • $view_mode: View mode, e.g. 'full', 'teaser'...
  • $page: Flag for the full page state.
  • $classes_array: Array of html class attribute values. It is flattened into a string within the variable $classes.
  • $zebra: Outputs either "even" or "odd". Useful for zebra striping in teaser listings.
  • $id: Position of the term. Increments each time it's output.
  • $is_front: Flags true when presented in the front page.
  • $logged_in: Flags true when the current user is a logged-in member.
  • $is_admin: Flags true when the current user is an administrator.

See also

template_preprocess()

template_preprocess_taxonomy_term()

template_process()

File

drupal/modules/taxonomy/taxonomy-term.tpl.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Default theme implementation to display a term.
  5. *
  6. * Available variables:
  7. * - $name: the (sanitized) name of the term.
  8. * - $content: An array of items for the content of the term (fields and
  9. * description). Use render($content) to print them all, or print a subset
  10. * such as render($content['field_example']). Use
  11. * hide($content['field_example']) to temporarily suppress the printing of a
  12. * given element.
  13. * - $term_url: Direct url of the current term.
  14. * - $term_name: Name of the current term.
  15. * - $classes: String of classes that can be used to style contextually through
  16. * CSS. It can be manipulated through the variable $classes_array from
  17. * preprocess functions. The default values can be one or more of the following:
  18. * - taxonomy-term: The current template type, i.e., "theming hook".
  19. * - vocabulary-[vocabulary-name]: The vocabulary to which the term belongs to.
  20. * For example, if the term is a "Tag" it would result in "vocabulary-tag".
  21. *
  22. * Other variables:
  23. * - $term: Full term object. Contains data that may not be safe.
  24. * - $view_mode: View mode, e.g. 'full', 'teaser'...
  25. * - $page: Flag for the full page state.
  26. * - $classes_array: Array of html class attribute values. It is flattened
  27. * into a string within the variable $classes.
  28. * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
  29. * teaser listings.
  30. * - $id: Position of the term. Increments each time it's output.
  31. * - $is_front: Flags true when presented in the front page.
  32. * - $logged_in: Flags true when the current user is a logged-in member.
  33. * - $is_admin: Flags true when the current user is an administrator.
  34. *
  35. * @see template_preprocess()
  36. * @see template_preprocess_taxonomy_term()
  37. * @see template_process()
  38. */
  39. ?>
  40. <div id="taxonomy-term-<?php print $term->tid; ?>" class="<?php print $classes; ?>">
  41. <?php if (!$page): ?>
  42. <h2><a href="<?php print $term_url; ?>"><?php print $term_name; ?></a></h2>
  43. <?php endif; ?>
  44. <div class="content">
  45. <?php print render($content); ?>
  46. </div>
  47. </div>