How to theme taxonomy term main page?
I'm trying to theme all the taxonomy main pages, but I can't figure out how to theme just the content area of the taxonomy page. I edited node.tpl.php and that did exactly what I wanted, but that affects all nodes, not just taxonomy nodes. Using the path conventions on this page: http://drupal.org/node/104316 I thought I could just make a copy of node.tpl.php and rename it node-taxonomy.tpl.php and be off to the races, but no dice. I can create page-taxonomy.tpl.php, but that themes the entire page, not just the content area. I even tried page-node-taxonomy.tpl.php, page-node-taxonomy-term.tpl.php, node-taxonomy.tpl.php, node-taxonomy-term.tpl.php and none of them worked. I don't want to be specific on the term number because I want to theme all taxonomy main pages (i.e. that page that lists off all the nodes tagged with that taxonomy term). Any insight would be greatly appreciated.

You need to use
null
solved
I used the following code in my template.php file to solve the problem:
if ($hook == 'node') {if (arg(0) == 'taxonomy') {
$vars['template_file'] = 'node-taxonomy';
}
}
I then copied my node.tpl.php to a file named node.taxonomy.tpl.php, modified it to suit my needs, and put node.taxonomy.tpl.php in my theme directory.
node-taxonomy.tpl.php
I think that should read node-taxonomy.tpl.php -- at least that's what worked for me.
If this don't changes
If this don't changes anything, try putting the
return $vars;after the second closing bracket.
This should go in the
This should go in the _phptemplate_variables function, like this:
function _phptemplate_variables($hook, $vars = array()) {
print "Hook: ".$hook;
switch ($hook) {
case 'node':
if (arg(0)== 'taxonomy') {
$vars['template_file'] = 'node-taxonomy';
}
break;
}
return $vars;
}
Different templates by type for term page
I extended this to the following:
<?php
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'node':
if (arg(0)== 'taxonomy') {
$vars['template_files'] = array(
'node-taxonomy',
'node-'.$vars['node']->type.'-taxonomy'
);
}
break;
}
return $vars;
}
?>
Now, I can use node-taxonomy.tlp.php as the default template for a node on a taxonomy term page, and override that on a per-type basis in much that same way that drupal core lets you define node-[node type].tlp.php templates.
override that on a per-type
How would you do this?
Say node-taxonomy.tlp.php is your defualt, and for a specific taxonomy term you wish to use a different node template, what would be the name. (i.e. would it be similar to node-taxonomy-[term name].tpl.php ?)
I think I figured out what
I think I figured out what you ment....
I believe it would be node-[node type]-taxonomy.tpl.php which works perfect for me.
Drupal 6 changes this. Here's what I did...
I am using Drupal 6.x as a large article repository, so I wanted my taxonomy pages just to show the title and a custom CCK "link_comments" field (i.e., just a page with a list of links to the articles on my site, organized by taxonomy tags).
I read this thread and http://drupal.org/node/132442 (which documents the changes for Drupal 6), but I couldn't get it to work. So I found the devel module, which is AWESOME, and was quickly able to see what new page and node templates ("candidates") I needed to create to do this without having to write any PHP code in the template.php file.
For me this ended up being two new files: page-taxonomy-term.tpl.php and node-[your node type].tpl.php. My node type is "ocic_article", so my file was node-ocic_article.tpl.php. From there I was able to use devel module to see which variables were available to me in addition to $content.
I hope this helps someone!
The above suggestions
The above suggestions somehow don't work for me. When I put the code above in the template.php file, the new node-taxonomy.tpl.php template is not called.
If I do not modify the template file but follow the suggestion of pbindagorge the result is an empty page being displayed with only a taxonomy term.
It seems all pretty simple but cannot find out what goes wrong.
Any help appreciated,
Gerben