No. Static routes are exactly that.; you cannot use parameters with them.
You'll need just a standard route:
|$route = new Zend_Controller_Router_Route(
'show/:id',
array(
'controller' => 'show',
'action' => 'display',
// You could set a default value for the :id parameter here
)
);
$router->addRoute('user', $route);|
Steven Szymczak wrote:
If I'm not mistaken, something like this should work:
$route = new Zend_Controller_Router_Route_Static(
'show',
array('controller' => 'show', 'action' => 'Display')
);
$router = $frontController->getRouter();
$router->addRoute('show', $route);
Joe Hagerty wrote:
I am new to the zend framework and am cutting over all my little small
apps and I am currently stumped on the role of routes & rewrites.
I have the following configuration:
application
--bootstrap.php
--Initializer.php
--default
---controllers
----IndexController.php
----ShowController.php
---models
----myModel.php
and the default route configuration used by Zend Studio for eclipse.
What I want to configure is bypassing the normal route config and
accomplish something like:
http://localhost/show/id/5
which should route to:
Controller=>ShowController
Action=>Display
and id=5 should be a request parameter.
Can anyone give me advice on how the route should be configured?
Thanks!
Joe