[drupal-devel] taxonomy nice URLs

Julian Bond julian_bond at voidstar.com
Wed Mar 23 14:23:56 UTC 2005


I did some work last night on tying to implement text URLs instead of 
the current numeric ones for taxonomy pages. So
/taxonomy/vterm/Tags/horse+riding
instead of
/taxonomy/term/23

What I've been trying is /taxonomy/vterm/vocab_name/term_name
all nodes for term term_name in vocabulary vocab_name using vterm means 
that the old /term/ still works.

I think /taxonomy/tterm/term_name is a mistake because nodes in Forum:UK 
(say) are not necessarily grouped or similar to nodes tagged with 
Location:UK. But maybe there is a good reason to group all nodes with 
the same spelt tag even if the tags are from different vocabs.

To achieve this I needed two helper functions
taxonomy_get_vocabulary_by_name($name)
taxonomy_get_term_by_name_and_vid($name, $vid)

It's then pretty easy to take
/taxonomy/vterm/Tags/horse+riding
and turn it into a comma delimited set of tids (probably just one)
and pass it to taxonomy_term_page();

In taxonomy_get_term($tid), a join to {vocabulary} to get the 
vocabulary.name field makes modifying taxonomy_link to generate these 
urls easy.

Thoughts?

-- 
Julian Bond Email&MSM: julian.bond at voidstar.com
Webmaster:                 http://www.ecademy.com/
Personal WebLog:          http://www.voidstar.com/
M: +44 (0)77 5907 2173      T: +44 (0)192 0412 433
S: callto://julian.bond/



More information about the drupal-devel mailing list