-- Aljosa Mohorovic <[EMAIL PROTECTED]> wrote
(on Tuesday, 07 August 2007, 05:35 PM +0200):
> what to do if i want my url to look like "pages/edit/1" and then it
> translates to:
> controller => pages
> action/method => edit
> and finally some var inside controller/method that contains "1" or
> whatever is located after action/method?
>
> how can i accomplish this?
Please read up on how to create custom routes using the router:
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes
In the example you give, you'd add a route like this:
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$pagesRoute = new Zend_Controller_Router_Route(
'/pages/:action/:id', // URL to match; action and id will be matched
array(
'module' => 'default', // 'default' module
'controller' => 'pages', // 'pages' controller
'action' => 'view', // by default, use view action
),
array(
'id' => '\d+', // require ID to be numeric
),
);
$router->addRoute('pages', $pagesRoute);
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/