Hi,

Is it possible to have routing determined (more or less) at runtime?
I'm thinking that in a CMS-type app, a user might want to choose what
a route maps to: say to a gallery action or an events calendar action.
Each of these actions could have different sub-routes. Static-ly, I
would do it something like (non-working example):

<route pattern="^(galname:\S+/" name="gallery" module="gallery">
  <route pattern="^$" name=".index" action="Index" />
</route>

<route pattern="^(eventname:\S+)/" name="events" module="events">
  <route pattern="^$" name=".index" action="Index" />
  <route pattern="^edit/$" name=".edit" action="Edit" />
</route>

The issue with the above example is that the "gallery" route would
always be matched, and the "events" one would not. I need some way to
dynamically choose at runtime which one. A few ideas:

- Have a callback in each route. The callback would query the database
(and possibly cache the result) to see if the current route should
match.
- Use a modified routing class. I'm not sure quite how to modify it though.
- Dynamically generate routing.xml itself. This could either be on
every request (somehow?), or just when a user makes a change.
- Don't really use routing.xml at all: have a "catch all" route that
maps to a "Control" action, that then processes the URL and forwards
to the correct action.

I'm not sure in which direction to go. Any suggestions?

Michal.

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to