In one of my apps:

routes.ini:

routes.main.type = "Zend_Controller_Router_Route_Regex"
routes.main.route = "(main.php|index.html)"
routes.main.defaults.controller = "index"
routes.main.defaults.action = "index"
(...)

Initialize.php

class XXX_Plugin_Initialize extends Zend_Controller_Plugin_Abstract
{
(...)

    public function routeStartup(Zend_Controller_Request_Abstract $request)
    {
        $this->initRoutes();
        (...)
    }

    public function initRoutes()
    {
        $router = $this->_front->getRouter();
        $routing_config = new Zend_Config_Ini($this->_appPath .
'/config/routes.ini', 'production');

        $router->addConfig($routing_config, 'routes');

    }
}

index.php or bootstrap.php or something  like this

(...)
$front->registerPlugin(new XXX_Plugin_Initialize((...)))
      ->addControllerDirectory(APPLICATION_PATH . '/controllers');
(...)

regards,
pch

2009/3/2 vadim gavrilov <vadim...@gmail.com>:
> Any example for this? Since i saw that Matthew didn't use any router.
>
> 2009/3/2 Paweł Chuchmała <pawel.chuchm...@gmail.com>
>>
>> On Mon, Mar 2, 2009 at 13:33, vadim gavrilov <vadim...@gmail.com> wrote:
>> > Thanks i already looked at those files. Still can i place an instance of
>> > the
>> > addRoute inside a certain controller? or do i need to place it somewhere
>> > in
>> > the bootstarp file? Basically what i would like to do is to make a file
>> > that
>> > will hold all the routes for each module/controller. Did anyone made
>> > something like that before?
>>
>> The best file is for me routes.ini. in config directory;-)
>> The rest in bootstrap initRoutes.
>>
>> Regards,
>> pch
>>
>> --
>> Paweł Chuchmała
>> pawel.chuchmala at gmail dot com
>
>
>
> --
> Vincent Gabriel.
> Lead Developer, Senior Support.
> Zend Certified Engineer.
>
>
>
>
>



-- 
Paweł Chuchmała
pawel.chuchmala at gmail dot com

Reply via email to