Mint
Mint

Reputation: 33

Different taxonomy_term view depending on vocabulary (Drupal)

I'm using taxonomy_term view to display term pages. The problem is that taxonomy_term view, when active, is used for every term page.

I need to display different term pages depending on the vocabulary that the term is assigned to.

If I have vocabulary "1", I need to display only image and title, when I have vocabulary "2" I need image, title and teaser. Finally, when using vocabulary "3", I need the same items as in vocab 2, but with different sort criteria.

Is there a way to accomplish this in a fairly simple way or at least a way to use taxonomy_term view for 2 vocabularies and use regular term pages for others? I searched on drupal.org, there are many similar questions, but usually the answer is that some other modules should be user (e.g. Panels), which is quite complicated and it affects speed performance. Here is a useful discussion, with a snippet, but it didn't work for me:

http://drupal.org/node/224231#comment-1981052

Upvotes: 3

Views: 2120

Answers (3)

mrryanjohnston
mrryanjohnston

Reputation: 373

As a followup to Jared, this site lists some ways to do this via code: http://www.appnovation.com/custom-taxonomy-term-pages

Basically, you're using hook_menu_alter() to look at the vocabulary name, then manually displaying a view of your choice.

This is a better option for D7, in my opinion, since the D7 version of TVI is not ready for production (according to the module page).

Upvotes: 0

Gokul N K
Gokul N K

Reputation: 2458

  1. Add one more(how many variants you want) page display for the taxonomy listing.
  2. In each of the display go to Filter and select Taxonomy: Vocabulary and then choose the vocabulary for you are creating this particular display.
  3. Change the fields accordingly in each of the display.

This will create different URL for each of the taxonomy page of the display. If you want all of them to have the same url then use attachment display and then attach all the displays to the basic page. And you are done :)

Upvotes: 0

Jared
Jared

Reputation: 721

The Taxonomy Views Integrator module is exactly what you're looking for: http://drupal.org/project/tvi

Upvotes: 3

Related Questions