[tbnl-devel] PATH_INFO

Alceste Scalas alceste.scalas at gmx.net
Sat Oct 8 07:52:21 UTC 2005


Il giorno ven, 07/10/2005 alle 11.04 +0200, Peter BARABAS ha scritto:
> OE.g. in
> http://www.something.net/authors/Kurt_Vonnegut "/authors/" would be
> the SCRIPT_NAME and "Kurt_Vonnegut" the PATH_INFO.

You could use create-groups-bind-regex-dispatcher, a macro I wrote just
for this pourpose: extracting parameters from URLs.  See the contrib/
directory, and the README file.

In short, you could append this to your *dispatch-table* (untested, the
regex may be wrong :-):

    (create-groups-bind-regex-dispatcher "^\\/authors\\/([^\\/])$"
      (author) authors-dispatch-fn)

And a dispatch-fn like this, that will take the author out of the URL as
a keyword argument:

    (defun authors-dispatch-fn (&key author)
       (do-stuff author))

You could (well, should) also url-decode the argument before passing it
to the dispatch-fn:
          
    (create-groups-bind-regex-dispatcher "^\\/authors\\/([^\\/])$"
      ((url-decode author)) authors-dispatch-fn)

Regards,

alceste
-- 
Alceste Scalas <alceste.scalas at gmx.net>




More information about the Tbnl-devel mailing list