0

Here is an example of a Route, taken from this page:

$route = new Zend_Controller_Router_Route_Regex(
    'blog/archive/(\d+)-(.+)\.html',
    array(
        'controller' => 'blog',
        'action'     => 'view'
    ),
    array(
        1 => 'id',
        2 => 'description'
    ),
    'blog/archive/%d-%s.html'
);
$router->addRoute('blogArchive', $route);

I can see that it matches paths that follow the pattern 'blog/archive/(\d+)-(.+)\.html', redirecting to the blog controller and view action, and passing along the id and description parameter. But, what is the purpose of the fourth argument; 'blog/archive/%d-%s.html'?

Chris Laplante
  • 29,338
  • 17
  • 103
  • 134

1 Answers1

0

I posted the question and found the answer on the page a few seconds later; what a surprise.

Since regex patterns are not easily reversed, you will need to prepare a reverse URL if you wish to use a URL helper or even an assemble method of this class. This reversed path is represented by a string parsable by sprintf() and is defined as a fourth construct parameter.

Chris Laplante
  • 29,338
  • 17
  • 103
  • 134