[Catalyst] CatalystSites.org

Toby Corkindale tjc at wintrmute.net
Wed Apr 16 08:02:16 BST 2008


On Fri, Apr 11, 2008 at 02:06:49PM -0700, Ashley wrote:
> On Apr 11, 2008, at 1:33 PM, Christopher H. Laco wrote:
>> /tag/name/<name>
>> /tag/id/<id>
>>
>> The greatness of future possibilities is expanded to much happiness. 
>> Chained/sub instance() make all the code behind either option JustWork.
>
> claco (I just like writing it) ++. This is mostly how I do it and for admin 
> functions I redirect to the id version. /tag/name/<name> going to its id at 
> /tag/id/<id>/edit as only the id is immutable for the record. Well, tags 
> are a bad example for this but an article name can certainly change.

I quite like using a regex to determine if it's a number or a word, and then
searching on the appropriate column (ie. Id vs Name). The computer does the
work so we don't have to.

Eg:
http://eventbot.dryft.net/people/view/13
==
http://eventbot.dryft.net/people/view/pir

(It's an old site of mine written in an afternoon; if/when I refactor it, those
URLs would be more REST-like, ie.
http://eventbot.dryft.net/people/(pir|13)/view
)

This has the disadvantage that you can't have tags, people, or whatever which
are numbers.. but hey, tough. I'm making my rules around here :)

Toby



More information about the Catalyst mailing list