(on Friday, 19 December 2008, 10:59 AM -0600):
> > The URL you're trying to build is targetting a different route -- in
> > this case, the "default" route. So, simply add a second parameter to
> > your url() call:
> >
> > <?php echo $this->url(array('action'=>'copy'), 'default'); ?>
>
> That worked, thanks. Is there a way it can detect the mod/ctr and I
> can just overwrite the action? This is the behavior I expected,
> though not for any particular reason other than terseness:
No. You're targetting different routes, and if you don't specify which
route to use to assemble the URL, it will assume the current route.
If your route can handle *both* the action *and* other metadata, then
you *could* do it this way.
> given page: /admin/reportbuilder/save
>
> 1. echo $this->url();
> // basically the current URL, such as /admin/reportbuilder/save
> // similar to $PHP_SELF in standard PHP
>
> 2. echo $this->ur(array('action'=>'copy'));
> // existing mod/ctr, overwrite action to 'copy': /admin/reportbuilder/copy
> // also defaults to $Name='default'
>
> Just trying to get a better understanding; I'm going to be using
> routing extensively in the near future.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论