I everyone who's reading this,
I was on the Internet 5 minutes ago and I found a URL that was pretty nice:
www.exemple.com/blog/rating.asc/2
Which is related to:
blog => controller/action/module or anything
rating => ordered by
asc => order of list
2 => current page
I would like to know how I can create similar URL using the Zend_Controller_Router_Route
class of Zend Framework.
For my website, it would be like:
www.exemple.com/portfolio/date.asc/2
or
www.exemple.com/blog/author.desc/ (page optional, default 1)
and
www.exemple.com/blog/ (default order: date.asc, page: 1)
NOTE: I'm not friendly with Regex, so I would like to forbid that or if someone who the exact expression, it would be appreciated.
Hey I'm not sure if you are use ini for configuration but here is how I'd do it if I had a:
module => blog
controller => article
action => list
// Parameter to get from the request in the controller
// Note that those are the defaults in case you don't provide any parameters in the url
sortBy => author
order => asc
page => 1
in the ini file:
; /www.exemple.com/blog/articles/author/desc/2
resources.router.routes.whateverroutname.route = /blog/articles/:sortBy/:order/:page
resources.router.routes.whateverroutname.defaults.module = blog
resources.router.routes.whateverroutname.defaults.controller = article
resources.router.routes.whateverroutname.defaults.action = list
resources.router.routes.whateverroutname.defaults.sortBy = author
resources.router.routes.whateverroutname.defaults.order = asc
resources.router.routes.whateverroutname.defaults.page = 1
Hope this helps :)