I want to build a CMS based on Zend Framework for my needs which has admin module with authentication and other modules (pages, users, news) which can be used as plugin modules based on the appliaction needs.
I want every module to have specific frontend and backend code, so that it could be accessed like e.g. http://localhost/mycms/pages/view/5 to view a certain page from the pages module by calling Pages controller, view action. The backend for every plugin needs to be tied to the admin and require authentication, it could be accessed like http://localhost/mycms/admin/pages/add.
The problem is that the solution I found involves removing default routes and writing custom routing for every controller action inside the plugin modules like:
$router->removeDefaultRoutes();
$route = new Zend_Controller_Router_Route_Static(
'admin/pages/add',
array(
'module' => 'pages',
'controller' => 'Pages',
'action' => 'add'
)
);
$router->addRoute('pages_pages_add', $route);
$route = new Zend_Controller_Router_Route_Regex(
'pages/view/(\d+)',
array(
'module' => 'pages',
'controller' => 'Pages',
'action' => 'view'
),
array(
'1' => 'page_id'
)
);
$router->addRoute('pages_pages_view', $route);
Do you have any ideas how I can avoid this custom routing?