taxonomy-term.tpl.php

You are here

Default theme implementation to display a term.

Available variables:

  • $name: (deprecated) The unsanitized name of the term. Use $term_name instead.
  • $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

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

Related topics

Comments

Use $term for quick access to term-id ,term-vocabulary, etc.

$term->tid
$term->vocabulary_machine_name

I have a Parent term "TermP" and its Child term "TermT1, TermT2..etc". I would like to have one common theme for parent term and another common theme for all child terms. I know, there is a way to do in terms of defining term ID something like "page--taxonomy--term--.tpl.php" OR "taxonomy-term.tpl.php".

But, all i need is independant templates for parent and child terms.