createUrl to current route?

Hi,

How do i make a link to the current page?

I’ve tried


$this->createUrl($this->route);

, but it doesn’t take params with it and


$this->createUrl($this->route,$_GET);

seems kind of ugly?

Thanks.

Maybe this helps you: http://www.yiiframework.com/doc/api/1.1/CHttpRequest#getQueryString-detail

Not really… :(


$this->createUrl('')

Will it obey the url rules and add params?

I use without shame $this->createUrl($this->route,$_GET);

I think the correct would be


$this->createUrl('/'.$this->route,$_GET);

Hi,

I know this is not the answer to your question (well, maybe partial :) ), but why won’t you use url currently requested?

d

It’s better to use the current route as the URL can change depending on the URL rules.

Hi Zaccaria

I had create current url adding extra parameter(s) in 2-3 different ways in the past.

But I had a few problems with url rules or (I think) security weakness

Your way is short and straight full

Please let me know:

  1. Is there any problem with url manager rules ?

  2. Is there any security issue ? (hacking etc)

Thanks