Hey,

I found that if I set the router name to the url helper it works:
<?php echo $this->url( array( "module" => "products", "controller" =>
"index", "action" => "current-offers" ), "default" ) ?>

But why I need to specify the router name "default" if I change the
behavior of the default routes?

Thanks for any help.

On Tue, Dec 14, 2010 at 10:53 AM, Juan Felipe Alvarez Saldarriaga
<[email protected]> wrote:
> Hey,
> I'm trying to append the region to the default routes, like:
> /co/module/controller/action, before 1.11.1 it was working, I'm using
> Zend_Controller_Router_Route_Chain to append a
> Zend_Controller_Router_Route object with the region as a param to each
> deafult route, so, this is my Bootstrap.php:
>
> <?php
>
> // Bootstrap.php
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
>    protected function _initRouting() {
>        /* @var $fc Zend_Controller_Front */
>        $fc = $this->getPluginResource( "frontcontroller"
> )->getFrontController();
>        /* @var $router Zend_Controller_Router_Rewrite */
>        $router = $fc->getRouter();
>        $routes = $router->addDefaultRoutes()->getRoutes();
>
>        /* @var $locale Zend_Locale */
>        $locale = $this->getPluginResource( "locale" )->getLocale();
> // resources.locale.default = "es_CO"; resources.locale.force = true
>
>        $hook = new Zend_Controller_Router_Route(
>            ":region",
>            array( "region" => strtolower( $locale->getRegion() ) ),
>            array( "region" => "[a-z]{2}" )
>        );
>
>        foreach ( $routes as $name => $route ) {
>            $chain = new Zend_Controller_Router_Route_Chain();
>            $chain->chain( $hook )->chain( $route );
>
>            $router->addRoute( $name, $chain );
>        }
>
>        $router->setGlobalParam( "region", strtolower( $locale->getRegion() ) 
> );
>    }
> }
>
> // layouts/scripts/layout.php
> echo $this->url( array( "module" => "products", "controller" =>
> "index", "action" => "current-offers" ) ); // string(1) "/"
>
> When I try to assemble a route using Zend_View_Helper_Url I get:
> string(1) "/" if the url is: http://192.168.2.10:8091/ but if I apped
> the region: http://192.168.2.10:8091/co the hwelper works: string(33)
> "/co/products/index/current-offers"
>
> What's wrong with my configuration?
>
> Thanks for any help.
>
> --
> Juan Felipe Alvarez Saldarriaga
> http://www.jfalvarez.com
>



-- 
Juan Felipe Alvarez Saldarriaga
http://www.jfalvarez.com

Reply via email to