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.

Reply via email to