I'm not entirely sure what you're looking for? The first case is the default 
match for any route. The second can map to any controller/action pair just like 
the first part - it doesn't need a database lookup, just have a matching 
module/controller/action or it will automatically divert to the 
ErrorController. The third case is still no different - add a route to a 
controller handling users, and include in it a possible parameter for the 
username.

These are all very easily accomplished with the default router. Is there some 
compelling need to rely on a database lookup? You could just match a 
controller/action, and then check if any parameter (e.g. your user name) is 
valid or not.

So long as a URL does not match a route, or a non-existing controller/action, 
it should use an ErrorController.

I strongly recommend re-reading the manual section on routing, adding routes 
and route parameters, and the use of an ErrorController.

 Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation Irish Representative





________________________________
From: oportell <[email protected]>
To: [email protected]
Sent: Fri, October 2, 2009 10:51:48 PM
Subject: [fw-general] A router that reacts to three different possibilities...


Hello, I have a question...

I want my application to react differently based on the url typed or clicked
by the user. 
And I want it to check to three different possibilities:

1) Does the url correspond to a valid (an existing) module/controller/action
combination, 
even if the word "default" is omitted for the default module? Then dispatch
it.

For example: www.example.com/module/controller/action
            www.example.com/controller/action (default module)

2) If that combination does not exist, look at a database whether the piece
of the url after 
"www.example.com" corresponds to a section of the website... If true,
dispatch a 
controller/action that shows this section of the site.

For example: www.example.com/sub1/subsub1/subsubsub3/subsubsubsub1

3) If not, look at a database if the piece of the url after
"www.example.com" corresponds 
to the username of a user and, if so, show his/her profile.

For example: www.example.com/profile34

4) If not, show an error.

How can I do that? Where should I do that?
-- 
View this message in context: 
http://www.nabble.com/A-router-that-reacts-to-three-different-possibilities...-tp25722083p25722083.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to