Question

Actually My web having language picker, its working nice but some one give redirect url for my webapp.

Example

http://yii.mywebapp.com/?redirecturl=http://www.google.com

It's all working fine...

But when click language picker the url will be

http://yii.mywebapp.com/?language=en

But i need the url not fully changed, i need only the full url following way

http://yii.mywebapp.com/?redirectUtl=http://google.com&language=en

How can i do this one?

Was it helpful?

Solution

I assume you simply want to preserve all GET parameters in the URL and simply add the language parameter to it.

The Yii Request object has a method called getQueryString() which will return all parameters currently available as a String.

Using that you could do the following to the example code you posted above to create your language picker URL:

<?php
$getParams = Yii::app()->request->getQueryString();
// ... 
?>
<!-- ... -->
<a href="<?php echo $baseURL . (empty($getParams) ? '?' : '&amp;' ); ?>language=fr">…</a>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top