That tutorial seems to be a bit dated as is not using Zend_Application. You
can still follow the suggestion and write a _initRouter() method to add that
code, or you can use the built in router resource plugin. Using the plugin
is probably simpler -- just edit your application.ini.

To use the built-in plugin, just append "resources.router." to each line in
the article's example ini and copy it into your application.ini.

This:

routes.popular.route = popular/:type/:page/:sortOrder

becomes this:

resources.router.routes.popular.route = popular/:type/:page/:sortOrder

etc.

For some reason, there doesn't seem to be any documentation on this plugin.

--
Hector


On Fri, Jan 8, 2010 at 5:58 AM, gelform <[email protected]> wrote:

>
> I'm trying to use the router for friendly URLs. I'm following this
> tutorial:
> http://sourcecodebean.com/archives/friendly-urls-and-the-zend-router/31
>
> It tells me to add this to my bootstrap:
> $config = new Zend_Config_Ini(APPLICATION_PATH . ‘/config/routes.ini’);
> $router = $frontController->getRouter();
> $router->addConfig($config,‘routes’);
>
> However my bootstrap looks like this:
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
> {
>    protected function _initAutoload()
>    {
>        $moduleLoader = new Zend_Application_Module_Autoloader(array(
>            'namespace' => '',
>            'basePath'  => APPLICATION_PATH));
>        return $moduleLoader;
>
>    }
>
>    function _initViewHelpers()
>    {
>        $this->bootstrap('layout');
>        $layout = $this->getResource('layout');
>        $view = $layout->getView();
>    }
> }
>
> Where do I create the router?
>
> Thanks,
>
> Corey
> --
> View this message in context:
> http://n4.nabble.com/Where-to-instantiate-router-in-my-bootstrap-tp1009683p1009683.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

Reply via email to