View Source

<ac:macro ac:name="note"><ac:parameter ac:name="title">Under Construction</ac:parameter><ac:rich-text-body>
<p>This proposal is under construction and is not ready for review.</p></ac:rich-text-body></ac:macro>

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}


Michael Minicki aka Martel Valgoerad

1.1 - 1 August 2006: Updated from community comments.

Zend_Controller_RewriteRouter allows for native PHP URL rewriting. It allows a usage of self created and controlled url schemes.

* Zend_Controller_RewriteRouter was inspired by Ruby routing:

The route interface was inspired by very early sketch of skeleton framework created on sitepoint forums (yet the code was written from scratch for my own project sometime ago): (skeleton classes)

I don't recognize a single line of code though ;)

No requirements at this point.

* Zend_Controller_Router
* Zend_Controller_Dispatcher
* Zend_Controller_Dispatcher_Token

Thanks to this component user can use self created URL schemes.

* Routes are matched in reversed order.
* Allows for setting named parameters
* Allows for setting defaults
* Allows for setting requirement masks
* Uses default if the url param value is not in a proper mask

* Zend_Controller_RewriteRouter
* Zend_Controller_Router_Route

$router = new Zend_Controller_RewriteRouter();

// Example URL:
// Controller: ArchiveController
// Action: showAction

$router->addRoute('archive/:year', array('year' => 2006, 'controller' =>
'archive', 'action' => 'show'), array('year' => '\d+'));

// Example URL:
// Controller: ForumController
// Action: threadAction
// Param 'id' which can contain digits only

$router->addRoute(':controller/:action/:id', array(), array('id') => '\d+');

// Example URL:
// Controller: UsersController
// Action: showAction
// Param 'name'

$router->addRoute('authors/:name', array('controller' => 'users',
'action' => 'show'));

$ctrl = Zend_Controller_Front::getInstance();

Zend_Controller_Front::run(BASE_DIR . 'webapp/controllers')


public function addRoute($map, $params = array(), $reqs = array());
public function route(Zend_Controller_Dispatcher_Interface $dispatcher);

public function __construct($route, $defaults = array(), $reqs = array());
public function match($path);
No milestones defined yet