2008年9月16日星期二

[fw-mvc] Routes for theming...

I'm writing a ZF app which needs to handle a number of whitelabel
versions of the application. I figured the best way to do this would be
with the router, but I'm just a bit stumped as to the best method.

Basically I want to take the first 'folder' in the path and translate it
into a 'theme' parameter if one exists. Once in the theme folder the
base url will be set as such so that the theme is sticky inside that folder.

So the site would display a list of products at the following url (using
the default theme)
http://www.foo.bar/products/view/id/123

... and similarly the themed version of that page is available at
http://www.foo.bar/mytheme/products/view/id/123

Currently, the default route would define it as such...
http://www.foo.bar/products/view/id/123/theme/mytheme

Basically, it wants to strip off the first directory if it's in a
predefined list and rewrite it as the theme parameter. Once that
parameter has been taken, it needs to route just as if it was in the
root folder.

Any ideas?

Regards,
Tim

没有评论: