2008年12月19日星期五

Re: [fw-mvc] Another routing question

> 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'); ?>
>
> --
> Matthew Weier O'Phinney

Matthew;

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:

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.

Thanks,
Hans

没有评论: