Hi Fuzz,
I've done this by extending a router. As a Step by step of what I did:
First create, if not already created, a path in your libraries file to extend your zend configuration; for example ZendExt.
Inside this folder create a subfolder named Controller and now create a new php called Router.php.
The content of this file would be something like:
Keep in mind the name of the class should be the same as the path to the class changing "/" for "_".Code:class ZendExt_Controller_Router extends Zend_Controller_Router_Abstract implements Zend_Controller_Router_Interface { public function route(Zend_Controller_Request_Abstract $request) { $module = ''; if(isset($_GET['module'])) { $controller = $_GET['module']; } $request->setModuleName($module); $controller = 'index'; if(isset($_GET['controller'])) { $controller = $_GET['controller']; } $request->setControllerName($controller); $action = 'index'; if(isset($_GET['action'])) { $action = $_GET['action']; } $request->setActionName($action); } public function assemble($userParams, $name = null, $reset = false, $encode = true) {} }
Now, set an autolloader for your classes in the application.ini:
Finally go into the Bootstrap (/application/Bootstrap.php) and load your router. For example:Code:autoloaderNamespaces.extension[] = "ZendExt_"
...and you're ready to go.Code:class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { ... /** * Bootstrap Router */ protected function _initRouter() { $this->bootstrap('frontController'); $frontController = $this->getResource('frontController'); $frontController->setRouter(new ZendExt_Controller_Router()); } ... }
By the way, make changes to the router so it takes the parameters you wish to take and assign them to the proper variables.
Cheers


LinkBack URL
About LinkBacks



Reply With Quote