[development] Human readable taxonomy URLs

Bèr Kessels ber at webschuur.com
Sun May 21 14:09:41 UTC 2006


Nice this comes up again, eventhough this has been discussed several times 
before w/o any result ;)

First of all: This goes far beyond only taxonomy. 
Second: this is only one possible use case.
Please look beyond blogs, in all these concepts. Drupal Is NOT about blogging, 
Blogging is merely /one/ possible case. 

Pathato does all this, but pathauto is not optimal ATM. The netto result is 
nice, but its inner workings are IMO not core-ish enough. 

That said, I proposed a concept of "mappings" a few times. I know that at that 
time Karoly liked the concept. 

hook_mapping() {
  $mappings[] = array(
    '#map' => '%screwdriver/details/%foo',
    '#variables' => array(
      '%foo' => 'bar',
      '%screwdriver' => toolbox(),

then l() and url() should run trough the mapping tos generate the urls. 

But wait! There is more. It can handle incoming links too! With a little 
fantasy, this can be used inside hook_menu, or even instead of hook_menu to 
map urls to code!
How wonderfull would it be to have a *central* place where all the url->code 
and code->url is generated in a consistent way! How fabulous would it nbe not 
to need a gazillion (I counted 160'000'000, yes 160 million) rows in one of 
my alias tables....) database entries, but to map the stuff dynamically.

  $mappings[] = array(
    '#title' => t('screwdriver details for %foo'),
    '#callback' => 'screwdriver_display_details',
    '#map' => '%screwdriver/details/%foo',
    '#variables' => array(
      '%foo' => 'bar',
      '%screwdriver' => toolbox(),

Yes. This is a performance issue. But no, that is not a reason to abandon it 
immediately. In fact, its a good reason to investigate it in more detail and 
see what this mapping can do for us.


PS: for more in depth details about this one should actually read the Ruby on 
Rails Mapping handbook. I have only paper books on this topic here, but there 
is a short and rough guide online: 
You didnt think I came up with this myself, huh? ;)
[ End user Drupal services and hosting | Sympal.nl ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20060521/103d5aaf/attachment.pgp

More information about the development mailing list