Witam

Czy ktos sie orientuje jak za pomoca url helpera w pliku widoku wyswietlic tą trase:

  1. <?php
  2. $translator = Zend_Registry::get('Zend_Translate');
  3.            Zend_Controller_Router_Route::setDefaultTranslator($translator);
  4. $locale = Zend_Registry::get('Zend_Locale');
  5.  
  6.        $route = new Zend_Controller_Router_Route_Regex(
  7.            ':lang/@nav-aktualnosci/(d+)-(.+).html',
  8.            array(
  9.                'lang'       => $locale->getLanguage(),
  10.                'module'     => 'default',
  11.                'controller' => 'news',
  12.                'action'     => 'view'
  13.            ),
  14.            array(
  15.                1 => 'id',
  16.                2 => 'description'
  17.            ),
  18.            ':lang/@nav-aktualnosci/%d-%s.html'
  19.        );
  20.                
  21.        $router->addRoute('news-view', $route);
  22. ?>


Z góry dziękuje za pomoc!


Problem rozwiązałem tworząc dwie oddzielne trasy i łącząc je w łańcuch:

  1. <?php
  2. $routeN = new Zend_Controller_Router_Route(
  3.            ':lang/@nav-aktualnosci',
  4.            array(
  5.                'lang'       => $locale->getLanguage(),
  6.                'module'     => 'default',
  7.                'controller' => 'news',
  8.                'action'     => 'index',
  9.            )
  10.        );
  11.        
  12.        $router->addRoute('news', $routeN);
  13.        
  14.        $routeR = new Zend_Controller_Router_Route_Regex(
  15.            '(d+)-(.+).html',
  16.            array(),
  17.            array(
  18.                1 => 'id',
  19.                2 => 'description'
  20.            ),
  21.            '%d-%s.html'
  22.        );
  23.        
  24.        $chainedRoute = new Zend_Controller_Router_Route_Chain();
  25.        $chainedRoute->chain($routeN)
  26.                     ->chain($routeR);
  27.           $router->addRoute('chain', $chainedRoute);
  28. ?>


Wyswietlanie w pliku widoku:

  1. <a href="<?php echo $this->url(array('id' => '12', 'description' => 'tytul-newsa'), 'chain', false, false) ?>">Jakis news</a>