I created a controller plugin to "route" the request to the cms controller.
Has someone suggestions to do this with a router.
class My_Controller_Plugin_CmsRouter extends Zend_Controller_Plugin_Abstract
{
/**
* Routes all (public) request to unknown modules to the standard
* Cms module / Page controller
*
* @param Zend_Controller_Request_Abstract $request
*/
public function preDispatch (Zend_Controller_Request_Abstract $request)
{
$dispatcher = Zend_Controller_Front::getInstance()->getDispatcher();
if (! $dispatcher->isDispatchable($request, $request)) {
$request->setModuleName('cms');
$request->setControllerName('page');
$request->setActionName('index');
}
}
}
berthausmans wrote:
>
> I'm building a small CMS and i want to create a router to route the
> request to the right module/controller. Below a list with some valid urls:
>
> # http://www.domain.com/rss/
> module = rss
> controller = index
> action = index
>
> # http://www.domain.com/system/sitemap/google/
> module = system
> controller = sitemap
> action = google
>
> # http://www.domain.com/news/archive/
> module = cms
> controller = page
> action = index
> url = /news/archive/
> page_id = 1 (search in database by url)
> (news is no module, if there's a page '(/news/archive/)' available route
> to the cms module)
>
> #
> http://www.domain.com/news/archive/item/the-item-alias-in-the-database/param2/value2/
> module = cms
> controller = page
> action = index
> url = /news/archive/
> page_id = 1 (search in database by url)
> item = the-item-alias-in-the-database
> param2 = value2
> (news is no module, if there's a page '(/news/archive/)' available route
> to the cms module)
>
> Is it possible to create a router/route(s) to handle above url's? I've
> already tried a number of implementations, but I have not succeeded.
>
> Who can help me?
>
--
View this message in context:
http://www.nabble.com/Problem-by-creating-a-custom-router-with-%22fall-back%22-to-a-%22CMS-database-module%22-tp19646242p19664328.html
Sent from the Zend Framework mailing list archive at Nabble.com.