Ah, now I see where the problem is. Must watch traces better:

2009-12-13T11:07:57+01:00 ERR (3): exception
'Zend_Controller_Router_Exception' with message 'id is not specified' in
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Controller\Router\Route.php:350
Stack trace:
#0
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Controller\Router\Rewrite.php(441):
Zend_Controller_Router_Route->assemble(Array, true, true)
#1
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\View\Helper\Url.php(49):
Zend_Controller_Router_Rewrite->assemble(Array, NULL, true, true)
#2 [internal function]: Zend_View_Helper_Url->url(Array, NULL, true)
#3
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\View\Abstract.php(340):
call_user_func_array(Array, Array)
#4 [internal function]: Zend_View_Abstract->__call('url', Array)
#5
G:\projects\PHP\automobi.li\application\modules\default\forms\QuickSearch.php(26):
Zend_View->url(Array, NULL, true)
#6 G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Form.php(235):
Automobili_Form_QuickSearch->init()
#7 G:\projects\PHP\automobi.li\library\ZendX\JQuery\Form.php(47):
Zend_Form->__construct(NULL)
#8 G:\projects\PHP\automobi.li\library\Umpirsky\Form.php(18):
ZendX_JQuery_Form->__construct(NULL)
#9
G:\projects\PHP\automobi.li\application\modules\default\views\scripts\search\view.phtml(11):
Umpirsky_Form->__construct()
#10 G:\projects\Libraries\ZendFrameworkLatest\library\Zend\View.php(108):
include('G:\projects\PHP...')
#11
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\View\Abstract.php(831):
Zend_View->_run('G:\projects\PHP...')
#12
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Controller\Action\Helper\ViewRenderer.php(903):
Zend_View_Abstract->render('search/view.pht...')
#13
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Controller\Action\Helper\ViewRenderer.php(924):
Zend_Controller_Action_Helper_ViewRenderer->renderScript('search/view.pht...',
NULL)
#14
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Controller\Action\Helper\ViewRenderer.php(963):
Zend_Controller_Action_Helper_ViewRenderer->render()
#15
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Controller\Action\HelperBroker.php(277):
Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#16
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Controller\Action.php(523):
Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#17
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Controller\Dispatcher\Standard.php(289):
Zend_Controller_Action->dispatch('viewAction')
#18
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Controller\Front.php(946):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http))
#19
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Application\Bootstrap\Bootstrap.php(77):
Zend_Controller_Front->dispatch()
#20
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\Application.php(358):
Zend_Application_Bootstrap_Bootstrap->run()
#21 G:\projects\PHP\automobi.li\wwwroot\index.php(25):
Zend_Application->run()
#22 {main}
2009-12-13T11:07:57+01:00 ERR (3): Zend_Controller_Router_Exception: id is
not specified in
G:\projects\Libraries\ZendFrameworkLatest\library\Zend\View\Helper\Navigation\HelperAbstract.php
#519.

So, in my quick search firm, which is rendered on that page, i have:

$this->getView()->url(array('controller' => 'search','action' => 'result'),
null, true)

and it tries to use same route, why? Why does it not use the default route?

Regards,
Saša Stamenković.



Daniel Latter wrote:
> 
> Strange, i don't get any error??
> 
> 
> 
> On 12 Dec 2009, at 16:16, umpirsky <[email protected]> wrote:
> 
>>
>> It processed the route from config as well, but throwed same error.
>>
>> Error does not occurs in url helper, like your reproduced case, but  
>> also
>> when I type in address bar
>> http://mysite.com/oglas/25
>> direct visiting my new route. Does it works same for you?
>>
>> Regards,
>> Saša Stamenković.
>>
>>
>> Daniel Latter wrote:
>>>
>>> Hi,
>>>
>>> OK, at least its processing you route.
>>>
>>> I manged to re-create this error by passing a null value to the id
>>> parameter
>>> when using the url helper, maybe this is your problem?
>>>
>>> Try: <?php echo $this->url(array(), 'car'); ?> and see if that works.
>>>
>>> Dan
>>>
>>>
>>>
>>>
>>>
>>>
>>> 2009/12/12 umpirsky <[email protected]>
>>>
>>>>
>>>> Hi.
>>>>
>>>> I get same as you from url helper. But visiting /oglas/25 gives me
>>>>
>>>> Fatal error: Uncaught exception 'Zend_Controller_Router_Exception'  
>>>> with
>>>> message 'id is not specified' in Zend\Controller\Router\Route.php: 
>>>> 350
>>>>
>>>> again (zf 1.9.6). So I get same behaviour as with application.ini :(
>>>>
>>>> Thanks for help again.
>>>>
>>>>
>>>> Daniel Latter wrote:
>>>>>
>>>>> Sorry, there is a typo in my email I have used 'olgas' instead of
>>>> 'oglas'
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 2009/12/12 Daniel Latter <[email protected]>
>>>>>
>>>>>> Hi umpirsky,
>>>>>>
>>>>>>
>>>>>> I have done some testing and I cant get the config method to  
>>>>>> work but
>>>> the
>>>>>> following works for fine me:
>>>>>>
>>>>>> // bootstrap _init function
>>>>>> // http://forums.zend.com/viewtopic.php?f=69&t=1312#p4770
>>>>>> public function _initRouter()
>>>>>> {
>>>>>>    $front = Zend_Controller_Front::getInstance();
>>>>>>    $router = $front->getRouter();
>>>>>>
>>>>>>     $routes = array(
>>>>>>                        'car' => new Zend_Controller_Router_Route(
>>>>>>                                'olgas/:id',
>>>>>>                                array('controller' => 'car',  
>>>>>> 'action'
>>>> =>
>>>>>> 'view')
>>>>>>                        )
>>>>>>      );
>>>>>>
>>>>>>    // Add some routes
>>>>>>    $router->addRoutes($routes);
>>>>>>    //...
>>>>>>
>>>>>>    // Returns the router resource to bootstrap resource registry
>>>>>>    return $router;
>>>>>> }
>>>>>>
>>>>>> // helper
>>>>>> <?php echo $this->url(array('id' => 22), 'car'); ?> = /olgas/22
>>>>>>
>>>>>> Also its defiantly possible to have something like:
>>>>>>
>>>>>> /oglas/product-name/25 -> Look into Route_Regex.
>>>>>>
>>>>>> HTH
>>>>>> Dan
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2009/12/12 umpirsky <[email protected]>
>>>>>>
>>>>>>
>>>>>>> I tried that as well, but got
>>>>>>>
>>>>>>> Zend_Controller_Dispatcher_Exception: Invalid controller  
>>>>>>> specified
>>>>>>> (oglas)
>>>>>>> thrown in Zend\Controller\Dispatcher\Standard.php on line 242
>>>>>>>
>>>>>>> as I said above.
>>>>>>>
>>>>>>> What url helper generates (oglas/25) is even better, but get  
>>>>>>> fatal
>>>> error
>>>>>>> (also explained above).
>>>>>>>
>>>>>>> Thanks for the answer anyway ;)
>>>>>>>
>>>>>>>
>>>>>>> Daniel Latter wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> Judging by what u want, shouldn't it be: /oglas/id/:id ?
>>>>>>>>
>>>>>>>> On 12 Dec 2009, at 10:52, umpirsky <[email protected]> wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hi.
>>>>>>>>>
>>>>>>>>> I want my url /default/car/view/id/25 to turn into /oglas/id/25
>>>>>>>>>
>>>>>>>>> In order to achieve this, I added in application.ini
>>>>>>>>>
>>>>>>>>> resources.router.routes.car.route = "/oglas/:id"
>>>>>>>>> resources.router.routes.car.defaults.module = "default"
>>>>>>>>> resources.router.routes.car.defaults.controller = "car"
>>>>>>>>> resources.router.routes.car.defaults.action = "view"
>>>>>>>>>
>>>>>>>>> When I try to visit /oglas/id/25, I get
>>>>>>>>>
>>>>>>>>> Zend_Controller_Dispatcher_Exception: Invalid controller  
>>>>>>>>> specified
>>>>>>>>> (oglas)
>>>>>>>>> thrown in Zend\Controller\Dispatcher\Standard.php on line 242
>>>>>>>>>
>>>>>>>>> When I use view helper to generate url
>>>>>>>>>
>>>>>>>>> " href="<?= $this->url(array('id' => $car->id), 'car') ?>">
>>>>>>>>>
>>>>>>>>> It generates /oglas/25 which gives
>>>>>>>>>
>>>>>>>>> Uncaught exception 'Zend_Controller_Router_Exception' with  
>>>>>>>>> message
>>>>>>>>> 'id is
>>>>>>>>> not specified' in Zend\Controller\Router\Route.php:350
>>>>>>>>>
>>>>>>>>> Where did I go wrong?
>>>>>>>>>
>>>>>>>>> And later, it would be even nicer if I can add some string  
>>>>>>>>> after
>>>>>>>>> oglas, like
>>>>>>>>>
>>>>>>>>> /oglas/product-name/25
>>>>>>>>>
>>>>>>>>> for better SEO. Is that possible?
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Saša Stamenković.
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>>
>>>>>>>
>>>> http://n4.nabble.com/Adding-simple-route-in-application-ini-tp961683p961683.html
>>>>>>>>> Sent from the Zend Framework mailing list archive at  
>>>>>>>>> Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>>
>>>> http://n4.nabble.com/Adding-simple-route-in-application-ini-tp961683p961693.html
>>>>>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://n4.nabble.com/Adding-simple-route-in-application-ini-tp961683p961779.html
>>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://n4.nabble.com/Adding-simple-route-in-application-ini-tp961683p961815.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> 


-- 
View this message in context: 
http://n4.nabble.com/Adding-simple-route-in-application-ini-tp961683p962899.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to