Php – Fallback route with Zend Framework


I'm having some difficulties while trying to understand the whole zend routing concept. My scenario is to have a fallback controller for my small cms app. I've already implemented my own route class for this. What it does is, similar to module route, to try to check if the module from the given path does exists, if not my cms controller will be called.
Here is the code example:

// ...
    public function match($path, $partial = false) 
        if (false === $this->_doesModuleExists($path)) {
            return parent::match($path, $partial);
        return array(
            'module' => 'static',
            'controller' => 'serve',
            'action' => 'view',
            'static_path' => $path
// ...

What i'm wandering about is, if there is a more elegant way to do this. Is my class really necessary for doing this task, because i think, it also possible to do this with the standard zend route's, but i just can't figure out how. Any help appreciated

Best Solution

Since I don't just want to re-post what I found using Google, I suggest you read the manual section on routing, especially the end of 12.5.4.

EDIT: Punish me, but this might even be a little better and clearer...

Related Question