-- David Mintz <[EMAIL PROTECTED]> wrote
(on Friday, 29 June 2007, 01:13 PM -0400):
> Just wondering how you recommend implementing even cleaner and more minimal
> URLs, e.g., if your action is something like edit or update and you expect the
> only GET parameter to be a record id, rather than
>
> example.com/things/edit/id/432
>
> simply: example.com/things/edit/432
>
> I guess you can parse it out of $this->_request->getPathInfo() but there's got
> to be a classier way, right?
Read up on the RewriteRouter and custom routes:
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes
Basically, considering the URL you have above, you'd define a custom
route like this:
$route = new Zend_Controller_Router_Route(
':controller/:action/:id',
array(
'controller' => 'index',
'action' => 'index',
),
array('id' => '\d+')
);
$router = $front->getRouter();
$router->addRoute('idRoute', $route);
You can also define routes based on regular expressions, and more.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/