[drupal-devel] taxonomy nice URLs

Morbus Iff morbus at disobey.com
Wed Mar 23 14:46:28 UTC 2005


> 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.

What does "vterm" mean (where "mean" is loosely connotated as "why is this 
a companion to "term" and why is this the best name for the new feature?")

> 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.

I agree, but I could see it being handy.
Maybe that'll be phase 2 for your patch.

> To achieve this I needed two helper functions
> taxonomy_get_vocabulary_by_name($name)

Understandable.

> taxonomy_get_term_by_name_and_vid($name, $vid)

"Iffy" on this one. I do/required something similar in
the patch I'm working on and did the following instead:

   $possibilities = taxonomy_get_term_by_name($typed_term);
   foreach ($possibilities as $possibility) {
     if ($possibility->vid == $vid) {

     }
   }

I chose to do it this way instead of defining a new function since I plan 
to rewrite parts of taxonomy to clean up some of the cruft. One of those 
changes would be to allow get_term_by_name to accept an optional $vid (as 
opposed to creating a new function).

> It's then pretty easy to take
> /taxonomy/vterm/Tags/horse+riding

Ah, fun, fun. I know what you mean here (a term called "horse riding"), 
but how does that relate to /taxonomy/term/1+2+3? (in this case, show me 
all nodes tagged with tid 1, 2, and 3). Would I ever be able to get "horse 
riding" and "bareback" and "nudity" in a URL, or would that functionality 
require me to use the non-vterm URLs?

For simplicity, I'm leaning toward "if you want combines, use non-vterms".

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

Hm. I think I'd support this change. It doesn't seem too damaging.

-- 
Morbus Iff ( you are nothing without your robot car, NOTHING! )
Culture: http://www.disobey.com/ and http://www.gamegrene.com/
Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/disobeycom
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus



More information about the drupal-devel mailing list