Re: Net_URL_Mapper or Net_URL_Router (was:Re: [PEAR-DEV] [PEPr] Proposal finished Networking::Net_URL_Mapper)
| From: | James Stewart | Date: | Fri, 02 Mar 2007 20:05:01 +0000 |
| Subject: | Re: Net_URL_Mapper or Net_URL_Router (was:Re: [PEAR-DEV] [PEPr] Proposal finished Networking::Net_URL_Mapper) | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-45782@lists.php.net to get a copy of this message | ||
On Mar 2, 2007, at 2:47 PM, Bertrand Mansion wrote:
Le 2 mars 07 à 19:18, James Stewart a écrit :In rails, that statement would be in your config/routes.rb file and would come inside a block, so the full declaration would be: ActionController::Routing::Routes.draw do |map| map.connect 'zip/:id' , :controller => 'locations', :action => 'zip' # Declare any other routes in here too end James. -- James Stewart Play: http://james.anthropiccollective.org Work: http://jystewart.net/process/On Mar 2, 2007, at 1:02 PM, Bertrand Mansion wrote:^^^ Just a question here, what is this map object ?In Rails and ZF and others, the router object is indeed routing: it takes the url and automatically deduces a 'controller' and an 'action', even if they were not defined in the url, then perform the action within the controller. While this is handy if you have a framework that was made to work this way, it's not very flexible because there is a lot more you can do with an url than just routing like this. Furthermore, in such frameworks, AFAIK (but I might be wrong), you always end up with urls like these: http://example.com/controller/action/arguments. This is also a limitation IMO.I've not used ZF, but that's not the case in rails. The default route is map.connect ':controller/:action/:id' but that can be removed or replaced with a wide variety of other options. eg. One I often use in location-driven sites is: map.connect 'zip/:id' , :controller => 'locations', :action => 'zip'