Friday, May 6, 2011

Zend Route Regex Reverse problem with forward slashes

Hi I have a problem with reverse for regex routes, my config file is below:

routes.route1.type = "Zend_Controller_Router_Route_Regex"
routes.route1.route = "([^\,]+)([^p]*)(?:\,page_[0-9]+)?\.html"
routes.route1.defaults.controller = "index"
routes.route1.defaults.action = "find" = "url_path" = "url" = "options" = "page"
routes.route1.reverse = "%s%s,page_%d.html"

the url will be,page_1.html the number of categories is unspecified current regex works fine, and gets all the categories at once, but the reverse formats all forward slashes to html format: %2F does anyone know how I can keep the forward slashes? I need the reverse for pagination and all the html entities look just plain ugly.

thx :)

From stackoverflow
  • If you're using the URL helper, set the fourth parameter to false to disable the encoding (which is on by default). So something like:

       'url_path' => 'whatever',
       'url' => 'something'
       'options' => 'foo',
       'page' => 'bar'
    ), 'route1', false, false)?>


Post a Comment