0

How can I override the default display of a taxonomy term with a view ?

eg : the path of a taxonomy term taxonomy/artist/artist_name take me to the default display of a taxonomy term and I want to display a specified view to the same path.

in resume override the path.

thanks !

1

When you changed the path of the taxonomy term as you state in your comment on George's answer, I assume you mean that you defined an alias using the Pathauto module. The problem with this is that Drupal reads the alias and converts it to taxonomy/term/% before it acts upon the URL. This means that your view is never called and the the default taxonomy view is used to display the content.

There are two ways to get to your view. The first is to use the default taxonomy view that George mentioned. The second is to remove the taxonomy alias in path auto so that no conversion is made to the path. Drupal will then direct its response to your View with that path name.

Also, it is not necessary to convert the path argument to to a term number for use in the contextual filter. You can also use the name. Set the configuration of the contextual filter to content:term id. Under the settings for "When the term is in the URL..." select the validation option and pick the validator "taxonomy term" and the vocabulary that applies. Then pick "term name converted to term ID" from the filter drop down box. You must also check "transform spaces..." if your URL can have multiple words for the term so that dashes and spaces are interpreted correctly together.

1

Make the page display path taxonomy/term/% and the first argument to the view should be the term ID. There is a disabled view for this purpose which should set these up for you, but if you already have a view you can also make that override the core taxonomy path by making the two adjustments I mentioned.

  • I changed the path of the taxonomy term from "taxonomy/term/%" to "taxonomy/artist/%" in the disabled view that i of course enabled. In the view all it's ok but when i go to the specified path in my browser it's display the default display and not my view. – Eliel Haouzi Mar 8 '12 at 14:36
  • I think you're confusing the path alias of your taxonomy terms with the actual system path that you want to over-ride. Have you setup any path aliases for the terms/vocabulary? – George Mar 8 '12 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.