[drupal-devel] taxonomy nice URLs
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/
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
Morbus Iff <morbus@disobey.com> Wed, 23 Mar 2005 09:46:26
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?")
It doesn't mean anything, it's just an alternative to /term/ to highlight that it works differently.
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) {
} }
That's a better way to do it.
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?
I wonder what flickr and del.icio.us do here. They allow both multi-word tags and tag addition in the filter. Since "+" is common url encoding for space, using it to mean "as well as" doesn't look right. But that's all just convention. How about /taxonomy/vterm/Tags/horse%20riding+horse. Isn't that going to come through php as "horse riding horse" in a single variable? -- 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/
can we not keep on supporting the existing, non ambigous urls. these urls are great, but not appropriate for certain links. also, some people insist on localizing their links which is insanity but there you go ... -moshe
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?
Moshe Weitzman <weitzman@tejasa.com> Wed, 23 Mar 2005 10:11:00
can we not keep on supporting the existing, non ambigous urls. these urls are great, but not appropriate for certain links. also, some people insist on localizing their links which is insanity but there you go ...
I'm not sure what to say here. The whole REST world is moving towards meaningful URLs, and they have a big advantage in that a 3rd party system can create them speculatively, so as long as I know the scheme I can construct http://www.drupal.org/taxonomy/vterm/tags/photo without knowing if "photo" is used or not. The other factor is that Technorati tags uses the final directory (/photo) to scrape the tag information out. With every folksonomy scheme doing the same thing so that they can be compatible with technorati. Similarly with things like Wikipedia. eg http://en.wikipedia.org/wiki/Category:Horses I don't want to break the existing Drupal scheme. But I do want to use a text based URL scheme as well. This was one of the reasons why I started building this entirely in contrib and adding extra links to the node so that folksonomy was entirely separate from taxonomy both in the code and in the UI. -- 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/
I very much support the idea of creating a mechanism to link into tags and node names directly. It seems this is coming up from a couple of places. One of the difficuluties is that you really need a mapping from http://www.drupal.org/node/12342 to http://www.drupal.org/taxonomy/horses (Or http://www.drupal.org/taxonomy/MyHorse) Is there a way to make this mapping automatic? so that users never see http://www.drupal.org/node/12342 unless intended? Julian Bond <julian_bond@voidstar.com> writes: % Moshe Weitzman <weitzman@tejasa.com> Wed, 23 Mar 2005 10:11:00 % >can we not keep on supporting the existing, non ambigous urls. these % >urls are great, but not appropriate for certain links. also, some % >people insist on localizing their links which is insanity but there you % >go ... % % I'm not sure what to say here. The whole REST world is moving towards % meaningful URLs, and they have a big advantage in that a 3rd party % system can create them speculatively, so as long as I know the scheme I % can construct % http://www.drupal.org/taxonomy/vterm/tags/photo without knowing if % "photo" is used or not. The other factor is that Technorati tags uses % the final directory (/photo) to scrape the tag information out. With % every folksonomy scheme doing the same thing so that they can be % compatible with technorati. Similarly with things like Wikipedia. eg % http://en.wikipedia.org/wiki/Category:Horses % % I don't want to break the existing Drupal scheme. But I do want to use a % text based URL scheme as well. This was one of the reasons why I started % building this entirely in contrib and adding extra links to the node so % that folksonomy was entirely separate from taxonomy both in the code and % in the UI. % % -- % 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/ ----- John Sechrest . Helping people use . computers and the Internet . more effectively . . Internet: sechrest@peak.org . . http://www.peak.org/~sechrest
I very much support the idea of creating a mechanism to link into tags and node names directly. It seems this is coming
Didn't the old title.module do this for nodes already?
http://www.drupal.org/node/12342 http://www.drupal.org/taxonomy/horses
You can do that with the path.module. -- 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
Morbus Iff <morbus@disobey.com> writes: % > I very much support the idea of creating a mechanism to % > link into tags and node names directly. It seems this is coming % Didn't the old title.module do this for nodes already? It might. But I like the direction that is going where it allows for taxonomies and then subselects of taxonomies that are shared (http://www.drupal.org/taxonomy/horses+cars) % > http://www.drupal.org/node/12342 % > http://www.drupal.org/taxonomy/horses % You can do that with the path.module. Isn't this done by hand. I need a way to do it automatically. ----- John Sechrest . Helping people use . computers and the Internet . more effectively . . Internet: sechrest@peak.org . . http://www.peak.org/~sechrest
It might. But I like the direction that is going where it allows for taxonomies and then subselects of taxonomies that are shared (http://www.drupal.org/taxonomy/horses+cars)
Well, the above poses a problem. Your URL is passing "horses cars" into Drupal. Should Drupal treat that as two terms, or one term? And what about horse+riding? chocolate+pebbles? frosted+flakes? Two terms or one?
% > http://www.drupal.org/node/12342 % > http://www.drupal.org/taxonomy/horses
% You can do that with the path.module.
Isn't this done by hand. I need a way to do it automatically.
Theoretically, you could cron a new module to create the associations for you automatically - there'd only be a slight delay from creation of the term to creation of the path. (The cron would be required for manual edits of a taxonomy, which don't have an API hook. If we're to assume that you only want paths for my "free tagging" patch, then you could insert yourself into the "save" of nodeapi.) -- 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
Morbus Iff <morbus@disobey.com> writes: % > It might. But I like the direction that is going where % > it allows for taxonomies and then subselects of taxonomies % > that are shared (http://www.drupal.org/taxonomy/horses+cars) % Well, the above poses a problem. Your URL is passing "horses cars" into % Drupal. Should Drupal treat that as two terms, or one term? And what about % horse+riding? chocolate+pebbles? frosted+flakes? Two terms or one? In my mind, I was seeing the "+" as a marker for two terms. would & be better? % > Isn't this done by hand. I need a way to do it automatically. % Theoretically, you could cron a new module to create the associations for % you automatically - there'd only be a slight delay from creation of the % term to creation of the path. (The cron would be required for manual edits % of a taxonomy, which don't have an API hook. If we're to assume that you % only want paths for my "free tagging" patch, then you could insert % yourself into the "save" of nodeapi.) I would rather not use a cron loop for this. It seems like a good source of errors. ----- John Sechrest . Helping people use . computers and the Internet . more effectively . . Internet: sechrest@peak.org . . http://www.peak.org/~sechrest
% > It might. But I like the direction that is going where % > it allows for taxonomies and then subselects of taxonomies % > that are shared (http://www.drupal.org/taxonomy/horses+cars)
% Well, the above poses a problem. Your URL is passing "horses cars" into % Drupal. Should Drupal treat that as two terms, or one term? And what about % horse+riding? chocolate+pebbles? frosted+flakes? Two terms or one?
In my mind, I was seeing the "+" as a marker for two terms. would & be better?
No - that's an even MORE insidious bug. Because when you ask for http://www.drupal.org/taxonomy/horses&cars with "Clean URLs" on, it turns into something like ?q=taxonomy/horses&cars, which means that a new GET parameter called "cars", with no value, is created. Certainly not what you intend. I think people have tried %26 in Drupal too (the decimal encoding of &), and there was a further problem with that. -- 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
On Mar 23, 2005, at 2:35 PM, John Sechrest wrote:
In my mind, I was seeing the "+" as a marker for two terms. would & be better? Ampersands cannot be used in paths, because they are the query string separator.
Morbus Iff <morbus@disobey.com> writes: % term to creation of the path. (The cron would be required for manual edits % of a taxonomy, which don't have an API hook. If we're to assume that you
Taxonomy edits sure do have a hook: http://drupaldocs.org/api/head/function/hook_taxonomy When implementing this, remember also that there can be multiple terms with the exact same name, even within the same vocabulary. This can make sense in hierarchical vocabularies.
Hello, Over the last several weeks, I have installed many drupal configurations. When I own the machine and I have a shell, this has been relatively easy. I am stranded on one install because I can't get a shell on the host. On others, I am finding that I can not install Listhandler/Mailhandler because they assume that I am able to recompile PHP to add the --imap... flag. However, when I look at SquirrelMail, I do not have to recompile PHP to get it working. And I am able to just use the Imap libraries that they developed? It would be much nicer if the PHP did not require the recompile. And it would be nice if I could just load in something like the SquirellMail libraries and have it run on a machine which I do not have root on. The underlaying assumption that I have a) root b) a shell c) the ability to recompile system configurations is one that does not work on various webhosting sites. ----- John Sechrest . Helping people use . computers and the Internet . more effectively . . Internet: sechrest@peak.org . . http://www.peak.org/~sechrest
On Wed, 23 Mar 2005, John Sechrest wrote:
Over the last several weeks, I have installed many drupal configurations. When I own the machine and I have a shell, this has been relatively easy.
I am stranded on one install because I can't get a shell on the host.
This really sounds like a support question. Please repost it at drupal-support. Cheers, Gerhard
Gerhard Killesreiter <killesreiter@physik.uni-freiburg.de> writes: % > Over the last several weeks, I have installed many drupal configurations. % > When I own the machine and I have a shell, this has been relatively easy. % > I am stranded on one install because I can't get a shell on the host. % This really sounds like a support question. Please repost it at % drupal-support. I was just whining about the lack of an install script that lets me install drupal without a shell. I will go over to drupal-support when I have the time to work thru the problem. At the moment, the install has been tabled until I get a block of time. The real point of the message was to outline the specific problem with having to recompile php, which is part of this same problem of assuming that people have root shell access on the machines. ----- John Sechrest . Helping people use . computers and the Internet . more effectively . . Internet: sechrest@peak.org . . http://www.peak.org/~sechrest
I was just whining about the lack of an install script that lets me install drupal without a shell.
this list is for development discussion. not for whining. for example, this list is a good place for posting a proposed technical design for such an install system. or if that is too ambitious, post a set of functional requirements. Or use cases. Or UI mockup. Whining on the list is disrepectful to he hundreds of people who dedicate time to read these messages.
The real point of the message was to outline the specific problem with having to recompile php, which is part of this same problem of assuming that people have root shell access on the machines.
all you need for installing drupal is ftp and phpmyadmin.
Moshe Weitzman <weitzman@tejasa.com> writes: % > I was just whining about the lack of an install script that lets % > me install drupal without a shell. % this list is for development discussion. not for whining. for example, % this list is a good place for posting a proposed technical design for % such an install system. or if that is too ambitious, post a set of % functional requirements. Or use cases. Or UI mockup. Whining on the list % is disrepectful to he hundreds of people who dedicate time to read these % messages. I am sorry, please accept my appologies. I thought that the rest of my message was in fact on target and in exactly the space that you want for drupal-devel. Please ignore the first paragraph as though it never happened. and focus on the second one. % > The real point of the message was to outline the specific problem with % > having to recompile php, which is part of this same problem % > of assuming that people have root shell access on the machines. % all you need for installing drupal is ftp and phpmyadmin. Yes, thank you. I know.... ----- John Sechrest . Helping people use . computers and the Internet . more effectively . . Internet: sechrest@peak.org . . http://www.peak.org/~sechrest
participants (6)
-
Gerhard Killesreiter -
John Sechrest -
Jonathan Chaffer -
Julian Bond -
Morbus Iff -
Moshe Weitzman