New taxonomy template On Drupal 7, I am trying to create a different version of the default taxonomy template file for a theme. When a user clicks on a taxonomy term, the new template file is used instead of the default one.

So far all I have managed to do is finding the correct template file name (page--taxonomy.tpl.php). The problem that I have is that the variables copied from the template file the Taxonomy module uses simply don't work, as they are obviously not being populated.

&lt;?php if ($content = render($page['content'])): ?&gt;
  &lt;div id="taxonomy-term-&lt;?php print $term-&gt;tid; ?&gt;" class="&lt;?php print $classes.' channels-'.strtolower(str_replace(' ','',$term_name)); ?&gt;"&gt;
    &lt;?php if (!$page): ?&gt;
      &lt;h2&gt;&lt;a href="&lt;?php print $term_url; ?&gt;"&gt;&lt;?php print $term_name; ?&gt;&lt;/a&gt;&lt;/h2&gt;
    &lt;?php endif; ?&gt;
    &lt;div class="content"&gt;
      &lt;?php print render($content); ?&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;?php endif; ?&gt;


So any variable beginning with $term is NULL. What/where do I call to populate these?
The only template file used from the Taxonomy module is the taxonomy-term.tpl.php file. If a theme implement that template file, it receive the following variables. (The list is partial; for the complete list see the documentation.)


$term_url: Direct URL of the current term
$term_name: Name of the current term
$term: Full term object


page--taxonomy.tpl.php is a page template that Drupal uses for pages with a URL matching taxonomy/*. It is a page template, for which the variables are different. In particular, it doesn't get any $term* variable.

References


taxonomy_theme()
theme_get_suggestions()