Keep URL Get-Parameter in all URLs

Hi there,

I wasn’t able to find topic on my issue.

If someone submits a certain get parameter (e.g. index.php?r=Action&my_parameter=2) I would like to keep that parameter for all futher urls.

What is the best way to achive this.

Thanks in Advance,

Philipp

Found the answer:

http://www.yiiframework.com/forum/index.php?/topic/9007-append-get-variable-to-the-end-of-all-urls/page__p__44827__hl__urls__fromsearch__1#entry44827

This doens’t work if i call $this-redirect() .

Is there another way someone can recommend?

best wishes peili

You have to post in all url, if you call redirect you should:




$this->redirect(array('route', 'myParameter'=>$_GET['myParameter']));



Or save it in the session.

Any idea how i can set it globally without changing each call?

You can save in the session, and so avoid to passing at each call.

There are no ways for specify a parameter in each call.

Unfortunatelly saving parameter in session is no option for me.

Urls have a parameter for an iFrame view. If the Url is linked to a different site those parameter will be lost.

In your unlucky case, you have to set the parameter everiwhere, or you can use session and pay attention to add the parameter to the url of each link that drives to an external page.

I found a way:

$this->redirect(array(‘name’));

Using an array the method createUrl is called :)

And what about the parameter you have to set all the times?

It’s added by his custom url manager class.