On Jan 12, 2011, at 4:56 PM, Bruno Rocha wrote:
> I am trying to configure a different way of routing, may be you can help me 
> or point some hint about it,
> It is a system where the user will register himself and get instant access to 
> an account (just like twitter), and the system will give a profile URL to the 
> user http://system.com/username and the actions needs to be as 
> http://system.com/username/controller/action.
> 
> I cant figure out how can I include the 'username' part.
> 
> For better understanding I am attaching an image about it. 
> (http://twitpic.com/3pi0cd)
> 
> Any ideas?
> 

I need to give that some thought.

It's somewhat similar to the way that the new router handles languages, except 
that the list of supported languages is static.

You'd need to have some reserved controller names that would never be user 
names, to allow for access to some functions before users are registered or 
logged in. Or some equivalent functionality.

With the regex rewriter, I suppose you could unconditionally move the first URL 
element to the query string, and always invoke the default controller, which 
would look at the query string and decide what to do, interpreting the reserved 
names as required. 

In my mechanism there's no way to do that. My intention originally was to allow 
for user-defined hooks, and I still might do that. You could define callback 
functions that would be called at strategic points, so you could look at the 
first URL element, stash it somewhere, pop it from the URL, and continue—same 
effect.

Or maybe what you want to do is sufficiently general that we could support it 
as a new mechanism: if the URL element in the controller position doesn't match 
a list of reserved names, save the element in request or request.env and set 
the controller to some designated value.

Reply via email to