How can I specify a $section_class for all taxonomy pages of a specific vocabulary?
I know how it's possible to specify this:
* page-taxonomy-term-1.tpl.php (where 1 is the term id).
* Tip: Use page-taxonomy-term.tpl.php to style all taxonomy term pages.

My problem is that I want to customize all taxonomy pages... but not from all vocabularies... just for some of them... so I can't use page-taxonomy-term.tpl.php to style all taxonomy term pages

thanks

Comments

Jeff Burnz’s picture

Here is the way to have template suggestions per vocab:

http://adaptivethemes.com/page-template-suggestions-for-taxonomy-vocabs

This will allow you to use a different template for each vocab, so all the terms in vocab 1 will use something like page-vocab-1.tpl.php etc.

An easy way to get the vocab in the section class is to put the vocab in the URL using Pathauto, so the vocab name is the first part of the URL for taxonomy term pages.

hedac’s picture

Thank you for your reply
I'll update that code to my particular needs because I'm not using taxonomy/term/ paths for my taxonomy pages... Using the "Taxonomy redirect" module so I can have different paths for taxonomy pages that can be used in "Views" to have also a different View for each vocabulary..

Seems a bit complex.. different views, and different theme templates for each vocabulary.... But that's what I need, and Thanks drupal is so wonderful and flexible :)
Thank you

hedac’s picture

ok it was easy now
I'm using for example
taxonomy/vocab1/term/tid
taxonomy/vocab2/term/tid
taxonomy/vocab3/term/tid

so I only need this:

if (arg(0) == 'taxonomy' && arg(2) == 'term' && is_numeric(arg(3))) {
$vars['template_file'] = 'page-vocab-' . arg(1);
}
Jeff Burnz’s picture

The arg is taken from Drupals *internal path* - it has nothing to do with the alias, you can rename the paths what ever you want.

hedac’s picture

yes.. "Taxonomy redirect" works on internal paths , not alias paths
Views arguments work with internal paths too, that's why I needed taxonomy redirect

Jeff Burnz’s picture

Status: Active » Fixed

OK, great, glad its working for you, I think we can call this fixed now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.