Hi Jan,

If you look to http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.regex you can see that there is a fourth parameter, where you can specify a reversed route. You can use this reversed route on the same way as you use vsprintf.

Regards,

Pieter Kokx

Jan Pieper schreef:
Okay, now my regexp route is: (?:index(?:/index(?:/.*)?)?)?

This should work to forward request to ArticleController::indexAction() but now an exception will be thrown:

> *Zend_Controller_Router_Exception*
> Cannot assemble. Reversed route is not specified.

What I have to do now? Search for it in code but there is no documentation for $reverse parameter (Zend_Controller_Router_Route_Regex::__construct). Then i searched in manual but also found nothing helpful.

If I use an empty string for 4th parameter ($reverse) it works, but i don´t think that this is correct.

-- Jan

Okay, my mistake but your solution allows something like /index/123 (if :article is the article_id). I want that /, /index and /index/index use ArticleController with indexAction. If no article_id is given, the application will show the newest article.

The actual problem is, that I don´t see a solution how to use ArticleController::indexAction() at /, /index and /index/index without adding one entry per route (= 3 routes with the same target). I think this will work, but I don´t think that this is an clean solution.

-- Jan

Jan Pieper wrote:

Where is my mistake? Why is / != /index != /index/index?

It's not the problem with your router implementation but with your route. You have specified a static route string (index/index), so it matches only this particular URL. Try something like this instead:

name=index {
     module: null
     controller: article
     action: index
     route: :controller/:article
}

-- Jan




--
Met vriendelijke groet,

Pieter Kokx
MaakSite.nl Productions
PHP Developer


Reply via email to