This seems like something that should be easy to do, but I can't figure it
out, and I haven't had any luck with forum searches.  I want to set up the
following routing structure:

/ : controller => RootController, action => index
/about : controller => RootController, action => about
/contact : controller => RootController, action => contact
/blog : controller => BlogController, action => index
/blog/recent : controller => BlogController, action => recent
/blog/archive/year/2007 : controller => BlogController, action => archive,
params => {year => 2007}

Basically, if the first element of the path is a valid controller, then the
request should be dispatched to that controller.  If not, it should be
dispatched to RootController.  I want to make adding a static page as simple
as possible, so I'm overriding RootController::__call() to render view
scripts based on the action name.  With that in mind, I don't want to use
static routes; I should just be able to drop a view script in the right
directory, and the new page will be accessible.

It just feels like I'm missing something about the standard routing, because
I imagine this is a common routing pattern.  Extending the ZF routing
classes seems excessive.  I guess I could catch EXCEPTION_NO_CONTROLLER in
my ErrorController, and then forward the request to RootController, but
again, that seems excessive.

Thanks for your help.

-- 
View this message in context: 
http://www.nabble.com/Routing%3A-actions-as-first-element-of-path-tp20908784p20908784.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to