Assign Custom URL to Listed Terms
| Project: | Taxonomy List |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
This is a nice module for listing out taxonomy with very little fuss. But, it is limited to only taxonomy-related listings when a term is clicked.
It would be nice to have the option of assigning a custom URL to the listed terms. This would make interfacing with existing views much easier. Given that producing the taxonomy list requires parsing through vocabularies and terms (both id and name), these variables could be available as arguments to any view's page display path, for example. Simple replacement tokens could be used.
Currently, I am hacking this module to do this (rewriting line 176):
# $new_tree[$tid]->title = '<div class="taxonomy-list-title">'. l($term->name, $term_path, array('attributes' => array('id' => $term->tid))) .'</div>';
$new_tree[$tid]->title = '<div class="taxonomy-list-title">'. l($term->name, "photogallery/" . $term->name, array('attributes' => array('id' => $term->tid),'alias' => TRUE)) .'</div>';This lists the taxonomy with appropriate links to my photo gallery view setup, passing the term name to the view as an argument.
http://drupal.org/project/taxonomyblocks does something similar in its approach to allowing custom URL paths per vocabulary in its setting page. However, it only passes the term id. I hacked it to allow term name as well by just adding another token replacement.
Larry

#1
Have you looked at Taxonomy Redirect?
#2
Hi Nancy
Hmm. I will look into it. Thanks for the tip.
I would prefer not to rely upon another module for interpreting destination URLs, especially if they could just be written accurately (and loaded with proper keywords from taxonomy) to begin with.
Maybe offer a PHP text box for substituting a custom URL (using the l() function), with the current default behavior if left blank? If so, a little list of the available variables would be all that's needed in a 'help' sentence.
Thanks for the quick and helpful reply,
Larry