views:

36

answers:

3

Hi guys I'm using zend framework here and I've enabled url-rewrite so all my urls are clean. The thing is that I've incorporated pagination of results on some pages and I want to append parameters to the url in this form:

www.mysite.com/controller/page/2

However I can't do it without appending the default action i.e index to the end of the url so I'm compelled to write urls like:

www.mysite.com/controller/index/page/2

How do I fix this so my url resembles the first one?

+1  A: 

I'm pretty new to ZF, but I think you can provide your own router to the front-controller. There you can add a route, which leaves out the "/index"-part.

faileN
thanks but How do I do that?
Ali
Maybe the documentation can help you. http://framework.zend.com/manual/en/zend.controller.router.html
faileN
+1  A: 

This could work, if you add it into your application.init

resources.router.routes.A.route = "index/page/:page"
resources.router.routes.A.defaults.controller = "Index"
resources.router.routes.A.defaults.action = "index"
resources.router.routes.A.defaults.page = "test"
ArneRie
I don't know, but the standard action and controller name is "index", within the front-controller, so is there a need for specifying it again?
faileN
A: 

Depending on the complexity of our setup you could just override the default route

resources.router.routes.default.route = :action/:page
resources.router.routes.default.defaults.page = 0
resources.router.routes.default.defaults.module = default
resources.router.routes.default.defaults.controller = index
resources.router.routes.default.defaults.action = index
resources.router.routes.default.reqs.page \d+
Ballsacian1