2009年9月29日星期二

Re: [fw-mvc] how to use a 'recursive' route

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dimitri van Hees wrote:
> Hi,
>
> I've searched the whole internet about this issue, but without success,
> so I'm trying it here now ;-) Imagine I have a site where a user can
> recursively add subpages. Ofcourse the user isn't able to add routes, so
> I bet I should add a 'recursive' route. This should be something like:
> */page** where *** = */userinput1/userinput2/userinput3* I assume. Then
> I think I have to handle this path myself. However, I am unable to get
> this whole path. Does anyone have a best practice for this? If I use
> *page(/\w+)+* in a regex route I am only able to retrieve the last part
> (*/userinput3*) without the preceding path. Anyone?

If you're using a regex route (you appear to be) then you can do
"page(/.*)" to get the entire url after "/page". This doesn't break it
into parts, but that should be easy to do at the application level (if
it's actually required).

I have run into a similar problem in a different context, the routing
doesn't seem to deal very well with situations where there are an
unknown number of parts.

- --

Brenton Alker
PHP Developer - Brisbane, Australia

http://blog.tekerson.com/
http://twitter.com/tekerson

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrBv5EACgkQ7bkAtAithuvppACg3cjvAQ+eYu6kO0jzTWWgMVWc
BGMAn0zQJPaPY7/NdKD9y7AIGC+mpXgQ
=3Et8
-----END PGP SIGNATURE-----

没有评论: