Yii 1.1: Create URL to language switcher anchor with langhandler

2 followers

This topic is related with langhandler extension

I'm actually find this solution and this is work in all cases and any page:

I just pushed the lang parameter to $_GET array and this is work, So please if you have better solution or any comment please share it with us.

Input:

$_GET['lang'] = 'en';
$url = $this->createUrl($this->id.'/'.$this->action->id,$_GET);

Output:

<a href="controller/action/id?sort=recent&lang=en">English</a>

Total 2 comments

#17656 report it
Rohit Suthar at 2014/07/11 10:18am
Another way
#17498 report it
le_top at 2014/06/23 05:42pm
My 2 cents

Not sure how this adds more information to the langhandler page.

Also, I suggest to use:

$lang='en';
        echo CHtml::link(
                ucfirst(
                        Yii::app()->locale->getLocaleDisplayName($lang,
                                'languages')),
                array('','lang' => $lang)
       );

Leave a comment

Please to leave your comment.