I'm looking to enhance the layout of the default taxonomy pages, but it seems to be rather hard-coded.

The menu hook calls back directly to taxonomy_term_page and that just starts generating output with taxonomy_render_nodes(). There's no theme() or module_invokes() I can use.
I can't see anyway to divert the rendering to a custom tpl, or even inject the term description or (specifically) the taxonomy_image ... where this page would be the obvious place to show it.
Could that function be opened up a bit more?

I've seen that some older attempts try to capture everything in page.tpl.php (wrong), make their own version (eg taxonomy_menu) or suggest to use views - which may get the result, but won't get the standard URL I want. Elsewhere the core creates links to taxonomy/term/n - I want to continue using that as the page that displays results in that category ... but I want to theme it!

One approach seems to be to override the core menu path directly but that seems to be a bit drastic and non-Drupaly considering 'most all other pages do this job through theme hooks.

Any clues anyone?

Comments

gravit’s picture

I think the default layout of this is to just list all the node teasers. In this case, you can edit your node-tpl.php file to customize what you want a teaser to look like, And of course you can override specific types by creating a node-blog.tpl.php, node-story.tpl.php, etc.

gravit’s picture

...But if you want to add a special header or footer over this page listing, then I guess the above won't help. You would have to find a way to customize this in your page template file.

dman’s picture

Yeah, I have no trouble doing each of the node_teasers inside the page, that worked. But seeing as this is going to be part of a big shopping cart experience, I need more header/footer/wrapper control.

I've just been experimenting with the views approach - which seems more than happy to just REPLACE the taxonomy/term/n functionality ... but is a whole 'nother theming challenge. It's a long way removed from the template files where I usually put my HTML structure. Still, it seems to be working OK so far.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

mishhh’s picture

I've also looked into the same problem today and I would like to know if there is a solution for theming taxonomy/term/xx pages...

I made an article_tags vocabulary and I want to create a single page for all terms in this vocabulary. This page would contain a tagadelic block and some views with arguments.

If I find something I will post here afterwards...

:)

dman’s picture

Seeing as one of the default 'views' that comes with views.module is one that replaces this functionality directly - over-riding the url path and returning a set of taxonomy-filtered teasers - I guess thid is the way I'm expected to go. For what I want I'll be embedding php code in the header, possibly footer. That UI for managing views is a monster.
I'm not comfortable with this approach, but I'll see if it works.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

ardee-1’s picture

This is weird ... today I've been trying to do this exact same thing ... except I just ABANDONED Views after having used it for 6+ weeks. It's too restrictive (you can't write PHP). The page I want has a custom table, generated by a query, but with unique (custom) rows inserted by my PHP code at fixed row numbers (OK, they're ads!) no matter what sort order is selected. Plus I show star ratings as numbers, to 2 decimal places and have some JavaScript.

I'd like to have my page invoked no matter what term is selected; my page would then just filter by that term. It would still show 13 nodes (plus 2 ad rows) in a 4-column table, per page, plus have pagers for more pages (if necessary).

I've tried the Taxonomy Redirect module, but that wants to append "/#" to the end of every URL it generates. I want it to end in "?term=#" instead, so it will go to a SINGLE page I wrote, where I can intercept the # and use it in a WHERE clause in my db query.

I see three possible but ugly solutions (other than using Views, which again I've gone beyond):

1) In page.tpl.php, invoke a custom page template if the path is of the correct type ("/taxonomy/term/#" or, if using Taxonomy Redirect, "/mycategory/#"). That custom page template would have the custom query, table, etc.

2) Change all places that invoke taxonomy lists (menus, tagadelic) to instead call my custom page with the term id as a parameter (seems kludgy). Maybe do change this via aliases (pathauto)?

3) Go into taxonomy.module and RIP OUT the code for the taxonomy_term_page function, replacing it with my own code. Seems VERY drastic.

None of these seems like a great solution. Perhaps there's a more elegant way we're all missing?

Squidgy’s picture

My solution was a variant on 1) - I did an if ( arg check ) and then called taxonomy-term.tpl.php, with the term id attached at the end with an ampersand, and then used a $_GET to apply that to the sql query. It's not the greatest solution, but it has the advantage of being very quick to do.

ardee-1’s picture

That sounds spot-on. I think I'll go that way too.

(Where can I learn about $_GET? I don't know what it is. Is it like checking args()?)

Squidgy’s picture

Pretty much - whereas args are the pieces of text in the url between slashes (/node/add/, etc.), $_GET['variablename'] is a way to pull information from the end of the url that's separated by ampersand's (&) s or question marks.

For example, given frank.com/?q=node/13&bob=something
print $_GET['bob'] will return 'something'.

You can learn more about it here.

Hope that helps!

ardee-1’s picture

Yup, you've explained $_GET well. Now I understand it.

I've chosen to go a different way: the clicks on my menus and on my Tagadelic entries all generate URLs like these:
taxonomy/term/<id>
(where <id> is a number), so I followed the advice from this page: http://drupal.org/node/46027
and created different page templates depending on what's in the path.

This is my new page.tpl.php:

<?php
if (arg(0)=="taxonomy" && arg(1)=="term" && is_numeric(arg(2))) {
  include 'page-taxonomy.tpl.php';
}
else {
  include 'page-default.tpl.php';
}
return;
?>

My page-default.tpl.php is just what used to be in the old page.tpl.php.
My page-taxonomy.tpl.php looks just like my page-default.tpl.php, except that the print $content; line is being replaced by my custom code.

I think this will work and is pretty easy.

If I run into problems with this approach, I'll post here again. Otherwise, consider it successful.

Thanks to all!

freeman-1’s picture

Been facing this issue too - ie. themeing taxonomy/term results. Previously with 4.7, I was using ardee's method 3) - i.e. hacking taxonomy.module. Well it worked but I guess it's time for me to follow the rules.

So I've been using Views for the current 5.1 version. I'm using some custom content types with embedded Views (installed the Views field (sub)module). I've even gone so far as to create specific fields in my content-types to allow OR'ing of classes of nodes for filters. And so far so good.

But I've got another problem which I don't seem to find anyone discussing in the forums. So pardon my 'hooking' onto this thread :-).

Essentially, I'm just looking at the native taxonomy/term/xxx display, and I've got two vocabularies. If I use Views (to override the default view), I cannot customize each vocab with its own separate Views template. This is especially bad because each vocab is used for a different content-type so even trying to embed PHP logic and fiddle with the Views logic for filters/arguments doesn't solve my problem.

So I'm now back to exploring non-Views methods to solve this issue.

Any thoughts and advice on this ?

tostinni’s picture

Change $tid by you current term id and it should help.
http://drupal.org/node/104316

dman’s picture

Only now, after templating for a year and just today tracing right deep into the theme engine, do I realize that there is a DIRECT connection between
page-node.tpl.php
and
/node/
- based on the URL, not on internal magic.

And yes, when I want to theme the page found at
/taxonomy/term/{n}
I can do so using
page-taxonomy-term.tpl.php
!!!

ETC etc.
I'd read that handbook page a few times, but never noticed it was a direct URL-resolution thing happening, I just thought it was made up internally.
O. wow. Life is about to get better!

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

RoloDMonkey’s picture

To expand on Dan's post. If you want to theme a particular taxonomy view, i.e. taxonomy/term/4, then you can include that too:

page-taxonomy-term-4.tpl.php

As Dan discovered you can basically turn any Drupal url into a custom theme by just replacing the slashes with dashes. This is not explained well in any of the literature.

--

Read more at iRolo.net

dnewkerk’s picture

Cool - I've been struggling with this for a long time too. Is there a way to override "just" the taxonomy listing part of the layout, and not the whole page? (e.g. I just want to override the format of how taxonomy lists the nodes in the term, not redo my whole page layout - which ultimately wouldn't help my situation anyhow, since I'd have a different layout surrounding the same taxonomy output). I tried (in place of page-) everything I could think of (view, views, node, node-type, etc, and removing the prefix altogether) with no luck, and tried enabling the "taxonomy_term" default View and using the Views theme wizard on that, also with no luck.

I'll keep at it, though hopefully someone can nudge me in the right direction. Thanks guys.

-- Dave
absolutecross.com

RoloDMonkey’s picture

You are definitely on the right track. I have done this by making new CCK content types and then theming the node or the view.

For instance here is a view of content types called bookmark, themed with node-bookmark.tpl.php

http://www.irolo.net/links/reference.htm

And here is a content type called supplier and a view with an alphabetic list of titles with optional links and images, created with views-list-suppliers.tpl.php

http://rhlco.com/manufacturers

--

Read more at iRolo.net

winston’s picture

I'm thinking this would have to be custom code in the node-contenttype.tpl.php file. I wish I knew how to do this.

To keep it simple, how would one test in php code to see if the page being rendered is for example taxonomy/term/5 vs taxonomy/term/20 (I'm just making these numbers up of course). If one could determine that in the node-contenttype.tpl.php page, then you could branch and display the node differently in each case. Anyone know how to do that?

For my site, I would like to display a certain content type one way when it is on a specific taxonomy view page, but another way when it is displayed on any other page (home page, other taxonomy view page, etc.)

--Peter

jiangxijay’s picture

Subscribe.

encho’s picture

Also looking for this.

RoloDMonkey’s picture

There is a way to intercept specific pages. To do this, you can create template files that start with page instead of node. For instance if you wanted to intercept all taxonomy/term/[n] pages you could create a page-taxonomy-term.tpl.php. If you wanted to intercept term 5 specifically, you could create page-taxonomy-term-5.tpl.php. As you can see the filenames are built by replacing the slashes in the URL with dashes. This can even work with URL aliases.

However, you should be careful about doing this because it can quickly lead to code duplication and a very bloated theme. I just implemented this another way by using the _phptemplate_page() hook. Unfortunately, I don't have time to write the full description of what I did right now.

--

Read more at iRolo.net

ardee-1’s picture

When you do find the time, I'm sure many people would love to hear that detailed description...

ulechka’s picture

I search a very long time how to theme different vocabularies with different templates. I mean theme term page for all term of one vocabulary one way, and for all term of other vocabulary in other way? Is it possible to create something like page-taxonomy-4.tpl.php where the 4 is taxonomy id? How can I know the taxonomy id?

I have several vocabularies in my site, each for one or two content types, and site sections that corresponds content types. For each section there is a menu block from taxonomy_meny + nice_menus... but I want to set different content in several region, so I allways use my page.tpl.php and it looks like a list of include commands...

dnewkerk’s picture

I ended up making some progress on this, after a few hours of teeth grinding :P

Unfortunately, I still didn't figure out how to theme taxonomy listings (besides the whole page.tpl.php override mentioned above) in the usual Drupal theming way (e.g. like overriding node.tpl.php or node-contenttype.tpl.php).

However I did get the "taxonomy_term" default View working, and was able to then theme its output the way I wanted to. So in case it helps anyone, I'll go ahead and outline the steps and provide an export of my View, as well as a copy of my views-list-taxonomy_term.tpl.php file and CSS. I'm reconstructing the steps after the fact, so if there are any glitches, please let me know. If it proves helpful (and people can provide any additional tweaks or fixes), I'll be happy to make a version in the Drupal Handbook.

I'm sure this is old news for some people... though for us newbies and un-programmers it might be useful :)


Getting started

Of course, firstly you will need to install and enable the Views module (as well as Views Theme Wizard & Views UI). I'm using Views 5.x-1.6 on Drupal 5.2.

You can't have a taxonomy listing without a taxonomy, so make sure you have a vocabulary and some terms set up already in admin/content/taxonomy so you can see the results of your new taxonomy theme. Also make sure you have some nodes tagged with these terms so you have something to list.

Also, I recommend you open up a few tabs in Firefox, each pointing to the same taxonomy listing page. One of them you'll be reloading along the way to keep an eye on your progress... and the other you'll be leaving "un-reloaded" while you work so that you can go back and refer to how it used to look before you blew it to pieces... er I mean, themed it :P

Lastly, if you've somehow survived the CSS revolution thus far without the Firebug extension... now's the time to get it (check GetFirebug.com for extra details - and the secret magic button you need most of all is the Inspect button). If you can theme without it... I want your autograph ;)


Setting up the "taxonomy_term" view

Alrighty then. The first step is to go to admin/build/views/import to Import the view which I'll include below (just paste it in, Submit, scroll to the bottom, and hit Save). This will save you "a lot" of steps in adding and tweaking all of the fields to include in the List view (once it's imported, you can go in and adjust things to your needs). In case you don't want to use my exported view, from the admin/build/views page, click the Add link next to "taxonomy_term" in the Default views area. This will create a new "override" view and take you to the edit page for the view to begin customizing. If you go this route you still might want to import a copy of my view for reference on which fields to use - and don't forget you have to use the List view.

Import this custom "taxonomy_term" view at admin/build/views/import
The configuration of this view is meant to approximate the standard fields output in the Garland theme, along with a tweak or two (such as a different date format that I think is more "human friendly").

  $view = new stdClass();
  $view->name = 'taxonomy_term';
  $view->description = 'The taxonomy view with a depth of 0.';
  $view->access = array (
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Taxonomy';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'list';
  $view->url = 'taxonomy/term';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->sort = array (
    array (
      'tablename' => 'node',
      'field' => 'sticky',
      'sortorder' => 'DESC',
      'options' => '',
    ),
    array (
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'taxid',
      'argdefault' => '1',
      'title' => '%1',
      'options' => '0',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'node_feed',
      'argdefault' => '2',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
    array (
      'tablename' => 'users',
      'field' => 'name',
      'label' => '',
    ),
    array (
      'tablename' => 'node',
      'field' => 'created',
      'label' => '',
      'handler' => 'views_handler_field_date_custom',
      'options' => 'F jS, Y',
    ),
    array (
      'tablename' => 'node',
      'field' => 'body',
      'label' => '',
      'handler' => 'views_handler_field_teaser',
    ),
    array (
      'tablename' => 'comments',
      'field' => 'add',
      'label' => '',
      'options' => 'Add new comment',
    ),
    array (
      'tablename' => 'term_node',
      'field' => 'name',
      'label' => '',
      'options' => 'link',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node, users, comments, term_node);
  $views[$view->name] = $view;



Custom "views-based" theming for your taxonomy term pages

First I should note: I made this while using the standard, unmodified Garland theme... it may not come out quite right at first in other themes (different CSS classes, HTML tag order, etc), but with a little tweaking and adjusting CSS class names and the order things appear in the HTML, it should be possible to get it whipped into shape in your own theme.

Your next stop will be the Views Theme Wizard at admin/build/views/wizard

Here you select the name of the View that you want to theme (in this case taxonomy_term: The taxonomy term with a depth of 0), and select Simple List for Theme Type. Press the Select Theme Type button to proceed.

First text area: template.php
Now in your text editor, open your theme's template.php file (or make one if one isn't present - if you're making a new template.php make sure you add the <?php tag at the top before anything else). Select all the code in the first text area and copy/paste it at the bottom of template.php. I won't waste space pasting mine here since your copy will be exactly the same.

Second text area: views-list-taxonomy_term.tpl.php
Click in the second text area, select all, and copy/paste this into a new blank file in your text editor. Save this file in your theme's directory as views-list-taxonomy_term.tpl.php.

Third text area: CSS
We're going to ignore the CSS text area. For some views you make, sure the CSS here might be useful (well, maybe - the CSS/code here doesn't tend to be on the "lean and mean" side)... but in this case we've already got the CSS in our theme that styled the taxonomy listing "the old way". We want to add those same classes to our HTML as a starting point, and then just modify the CSS to make our amazing redesign of taxonomy listings.

Just for encouragement, head over to one of the tabs you opened earlier of your taxonomy listing and reload it. It looks a bit weird right now (don't worry, we'll get to that)... but holy smokes it works!


Customizing the HTML and CSS to make things look... right

You've probably noticed that the code in views-list-taxonomy_term.tpl.php looks a bit scary. However once we brush away some unnecessary stuff it will look a whole lot more welcoming (HTML "can" look welcoming... can't it? haha).

If you want to take the easy road, young grasshopper, then just erase everything you pasted into the file and replace it with my example code below. For the more adventurous (and of course anyone with a theme besides Garland)... start by removing ALL of the div tags that surround PHP variables that say "$something_label". Also, you can keep it for reference if you want, but you can delete the whole area between the <?php and ?> tags so nothing remains but plain old HTML (also remove the drupal_add_css part, since we won't be needing it).

views-list-taxonomy_term.tpl.php that emulates Garland's taxonomy listings

<div class="taxonomy-list-item">

<h2><?php print $title?></h2>

<span class="submitted">
  <?php print $created?> &#8212; <?php print $name?>
</span>


<div class="content">
  <?php print $body?>
</div>

<div class="clear-block clear">
  <div class="meta">
    <div class="terms"><?php print $term_node_name?></div>
  </div>

  <div class="links"><?php print $add?></div>
 </div>

</div> <!-- /taxonomy-list-item -->


Addition to style.css
I also added the following CSS to my style.css file, as it helps get elements back in their proper positions, and also gets rid of the unordered list bullet points that appear by default next to every field in the view (this overrides a default CSS class in system.css and/or style.css of Garland - it only applies "within" a view, so it doesn't affect other areas of the page, such as the menu where you actually "want" the lists to behave this way). You can also go all out and restyle these any way you want.

/**
 * Styling for Taxonomy Term Listings
 * Recycles some classes from the default style so we can override/customize separately
 */
.taxonomy-list-item {
  border-bottom: 1px solid #E9EFF3;
  padding: 1.5em 6px;
}

.taxonomy-list-item .content {
  margin: 0.6em 0;
}

/* Showing this class since you might want to set it to float: none; */
.terms {
  float: right;
}

/* Removes all list item styles within the View */
.view .item-list ul li {
  list-style-image: none;
  list-style-position: outside;
  list-style-type: none;
  background: none;
  margin: 0;
  padding: 0;
}



Now theme away!

Your taxonomy listings now look just about the same as they did before - but now they're completely editable! Go forth Drupal theming ninja... design great and wonderful things :)


A few quirks - maybe others can improve these bits

  • I couldn't figure out how to get the additional class of "inline" into the list of taxonomy terms that seems to give extra spacing around each term... e.g. <ul class="links inline">
  • My HTML and CSS hasn't been tested yet in a eh... particular browser... ah hem... if anyone would like to confirm it works feel free.


-- Dave
absolutecross.com

xmaro’s picture

How to theme taxonomy term view depending on VOCABULARY ?

Maybe using theme Wizard in views ?

Another idea:
If I use pathauto url > vocabulary_1/term_name. Can I make custom template file called vocabulary_1.tpl.php ??

So term list view would depend on vocabulary.

najibx’s picture

yes, I would like to know rather than using URL to carry out filtering by VOCAB in Views, use the theme to do the job instead. Look quite similar?

-najibx-

salvatoreco’s picture

Hi all! I'm sorry for cross posting. I've tried Keyz's method, but I still can't view my view instead of the classic taxonomy list... I'll make the question harder using pathauto, too :-D.

I'm doing a Flickr-like site using Drupal 5.3. I've installed these modules: Views, CCK, Imagefield for CCK, Imagecache, Pathauto and Token.
Well, after I made new content type (photo entry) with CCK + Imagefield (using imagecache, too), I've done a new vocabulary for photo's tags, then I've assigned new url alias with pathauto and token like this:

  • Pattern for all Photo paths: photo/[user]/[nid]
  • Pattern for all Photo tags paths: photo/tags/[catpath]


Then I've made a new View for viewing all photos linked to a specific tag using the path photo/tags/#name-of-tag. This is the export of that view:

$view = new stdClass();
  $view->name = 'foto_tags_view';
  $view->description = 'Visualizza le foto associate a un tag';
  $view->access = array (
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Foto per il tag "%1"';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '<div id="bot_views_foto"><h4>Sfoglia per tag</h4><?php
  $vid = 1;         /* <---- put correct vocabulary ID here */
  /* $show_pic = module_exists(\'taxonomy_image\'); */
  echo \'<div class="tag_cloud_foto">\';
  $terms = taxonomy_get_tree($vid);
  /* while (list($count, $term) = taxonomy_term_count_nodes($term->tid)) $terms[$term] = $count;
  $massimo = max($terms);
  $minimo = min($terms);
  $distribution = ($max - $min) / 5; */
  
    foreach ($terms as $term) {
		$count = taxonomy_term_count_nodes($term->tid);
		
		$massimo = max($terms);
		$minimo = min($terms);
		$distribution = ($massimo - $minimo) / 5;
		
		if ($count == $minimo) {
			$tag_class = "moltopiccolo";
		}
		elseif ($count == $massimo) {
			$tag_class = "enorme";
		}
		elseif ($count > ($minimo + ($distribution * 2))) {
			$tag_class = "grande";
		}
		elseif ($count > ($minimo + $distribution)) {
			$tag_class = "medio";
		}
		else {
			$tag_class = "piccolo";
		}
	
		echo \'<span class="\'.$tag_class.\'">\' .l($term->name,\'photo/tags/\'.$term->name, NULL, NULL, NULL, NULL, TRUE).\'</span>\';
   } /* end foreach */
  echo \'</div>\';
?>
</div>';
  $view->page_footer_format = '2';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'list';
  $view->url = 'foto/tags';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '24';
  $view->sort = array (
    array (
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'taxletter',
      'argdefault' => '1',
      'title' => '%1',
      'options' => '0',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'node_feed',
      'argdefault' => '2',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node_data_field_immagine_foto',
      'field' => 'field_immagine_foto_fid',
      'label' => '',
      'handler' => 'content_views_field_handler_ungroup',
      'options' => 'foto-thumb_linked',
    ),
    array (
      'tablename' => 'term_node_2',
      'field' => 'name',
      'label' => '',
      'options' => 'link',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'foto_entry',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node, node_data_field_immagine_foto, term_node_2);
  $views[$view->name] = $view;

Well, if I go to photo/tags/#name-of-a-tag Drupal returnes to me the taxonomy page list instead of the view I've made.
Is there a way to override taxonomy path with custom view path?

lupus78’s picture

I have a solution simlar to Soter82, and it dosen't works for me. My code is the following for "Taxonomy: Term ID" argument:

if ( isset($args[0]) )  {
$sql = "SELECT src FROM {url_alias} WHERE dst = 'video/". $args[0]."'";
$result = db_query($sql);

if (isset($result)) {
  $termid= array();
  while ($termpath = db_fetch_array($result)) {
    $termid[] = substr(strrchr($termpath['src'], "/"), 1);
  }
  $args[0] = $termid[0];
}
}
return $args;

I have the names of the terms set up with Pathauto and it is like 'video/speedflying'.
If i request the video/speedflying page i get the default taxonomy term listing interface, not my view.
Am I missing something? How can I disable the default for taxonomy terms?

askibinski’s picture

Some solutions in this thread are based on using Views.

If you want to do it with taxonomy, try the solution mentioned here
http://drupal.org/node/135130

Albert Skibinski - Homepage

cakka’s picture

Hi, i am looking this too.

But for my case... in taxonomy/term/n...
I only want to display some fields from the node.
Thanks

pan69’s picture

I'm trying to get this to work as well. What I don't understand is why taxonomy terms/vocabs are treated as pages and not similar to how node templates work. What you'd ideally what is to implement a template for a certain vocabulary or even a term or a specific term id in a vocabulary. Something like:

taxonomy-vocab-term-tid.tpl.php
taxonomy-vocab-term.tpl.php
taxonomy-vocab.tpl.php
taxonomy.tpl.php

But that's unfortunately not how it currently works (which I think is weird). Almost as if it's been forgotten. I was expecting that there would be template_preprocess_taxonomy hook where I can create the template suggestions based on the path just as I can do for nodes and pages.

The way it currently works is not very flexible becuase it only allows me to create a template for 'taxonomy', as if all taxonomy is the same. I have plenty of vocabularies that are totally different from each other and I'd like to display them in their own distinct way.

Not sure how I'm going to some this in a non-hacky way or without lots of duplication... Any suggestions are welcome.

- Luke

ridefree’s picture

I've used taxonomy to organize many different parts of my site and need to be able to theme vocabs differently.

lookin fwd to suggestions :)

marcushenningsen’s picture

Is there a way to disable/remove /taxonomy/term pages alltogether?

jefftrnr’s picture

The taxonomy module is optional, so you could disable it.

Or, if you still want taxonomies in the db (for views, etc.) but want the pages removed, maybe add the drupal_not_found() to some php in your page-taxonomy-term.tpl.php page

.. or probably better to add that function within an if statement inside your theme's preprocess_page() override.