Multilanguage and Url Generator


How add a value in generated Url without change any line of my code contains CHtml::link

for example

if the requested url has the lang=en paramater then all of links in the new page get additional parameter lang=en

if page has the following links & lang=en & lang=en & lang=en

then if I click then the page should has the following & lang=gr & lang=gr & lang=gr


extending CUrlManager

Good approach Gustavo.

Firstly I tried to extend CHTml link but it is better to extend CurlManager.

I tried to Extend CurlManager and I added code in main.php in part ‘application components’




But when I try to run the site I get error 'Cannot redeclare class UrlManager '.

I havent redeclared in main.php about urlManager. Obviously the Capplication declares this automatically.

How to fix that?

Opps my wrong!

I wrote UrlManager extends CUrlManager { … } instead MyUrlManager extends CUrlManager { … }

Its work, Thanks!