Matthew Weier O'Phinney-3 wrote:
>
> -- spaun <[EMAIL PROTECTED]> wrote
> (on Thursday, 08 November 2007, 04:32 AM -0800):
>> Matthew Weier O'Phinney-3 wrote:
>> > -- spaun <[EMAIL PROTECTED]> wrote
>> > (on Wednesday, 07 November 2007, 10:57 PM -0800):
>> > > One more idea - wouldn't it be nice to have an option to inject a
>> link
>> > > assembler to route?
>> > >
>> > > For example I have an url with optional parameters and Regex
>> > > route. Currently the only way to assemble and url is to provide a
>> > > reverse pattern. What if I'd like to omit empty parameters from
>> > > url?
>> > >
>> > > Feeding the route with optional url assembler could help. Changes
>> > > to current classes are minimal. Result is 100% backward
>> > > compatible. What you think?
>> >
>> > All routes have an 'assemble' method already. Regex routes are a little
>> > tricky in that regards, which is why the reverse pattern is necessary,
>> > but in the others, you simply pass in the key/value pairs you desire in
>> > the URL, and the assemble method then creates the URL. This
>> > functionality is used by the Url view and action helpers.
>>
>> Actually what I propose is the _option_ to_replace_ default assemble
>> functionality. Especially this could make sense for regex router.
>
> How do you propose to do so? The verbiage you have above doesn't give me
> a clear enough idea.
>
> --
> Matthew Weier O'Phinney
> PHP Developer | [EMAIL PROTECTED]
> Zend - The PHP Company | http://www.zend.com/
>
>
The idea was to extend Zend_Controller_Router_Interface with method
setAssembler($assembler);
And assembler could something like this:
class UrlAssembler
{
public function assebmle($router)
{
$data = $router->getData();
//the magic to build url from data here
return $url;
}
}
and in bootstrap
$route = new Zend_Controller_Router_Route_Regex(...);
$route->setAssembler(new MyAwesomeUrlAssembler());
$router->addRoute('archive', $route);
--
View this message in context:
http://www.nabble.com/Route-enhancement-tf4769342s16154.html#a13647918
Sent from the Zend Framework mailing list archive at Nabble.com.