I will try this. Thanks,
On Fri, Mar 12, 2010 at 12:42 PM, Alayn Gortazar <[email protected]> wrote: > El vie, 12-03-2010 a las 12:32 +0200, scs escribió: >> Hello, >> I have a initRoute function in bootstrap file: >> protected function _initRoutes() >> { >> $this->bootstrap('frontController'); >> $frontController = $this->getResource('frontController'); >> $router = $frontController->getRouter();// Get Router >> >> //USER ACTIVATE >> $route = new Zend_Controller_Router_Route( >> 'user/activate/:code', >> array('module' => 'default', 'controller' => 'user', 'action'=> >> 'activate') >> ); >> $router->addRoute('activateUser', $route); >> } >> >> I form activation links as below and it works great: >> $this->url(array('code' => $this->activation->activationCode), >> 'activateUser'); >> >> However, when I browse http://domainname/user/activate/j3j4h4h, >> all of my urls I form with $this->url(), show the activation link. >> >> I form a link as below: >> <?php echo $this->url(array('module'=>'admin', 'controller'=>'user', >> 'action'=>'list'));?> >> But this link displays in href: >> http://domainname/user/activate/j3j4h4h instead of >> http://domainname/admin/user/list if the activation link is browsed on >> the browser. >> >> Hope I made it clear. >> If i change my normal links to >> <?php echo $this->url(array('module'=>'admin', 'controller'=>'user', >> 'action'=>'list'), 'default');?> >> then they show correctly even in the activation link page. However, >> now I have to add 'default' param to all of the links sitewide I >> generate with >> this->url. >> Is there a trick/tip or idea that i can solve this problem a bit more easily? >> Hope I made it clear. >> >> thanks in advance > > You could override the url helper to make 'default' the default route... > > class Custom_View_Helper_Url extends Zend_View_Helper_Url > { > > public function url(array $urlOptions = array(), $name = null, > $reset = false, $encode = true) > { > if(is_null($name)){ > $name = 'default'; > } > return parent::url($urlOptions,$name,$reset,$encode); > } > } > > > -- > Alayn Gortazar > Irontec, Internet y Sistemas sobre GNU/LinuX - http://www.irontec.com > +34 94.404.81.82 > > >
