Parameter Get Urlmanager

Hi to everybody, i can’t get a parameter via GET in my “beingRequest” from my urlManager. I got this in my urlManager:


'<lan:[a-z]{2}+>/' => 'site/index/',

and in my beingRequest i got:


echo('<pre>');

print_r($_GET);

echo('</pre>');

And all i have is an a array empty. Is It stupid what i’m trying to do?

All this is to change a language coockie I uso in beingRequest.

Thanks!

Your regular expression is invalid I believe. Try:




'<lan:[a-z]{2,}>/' => 'site/index/',



Thank for your help, i tried it but nop, I think it can’t be the problem, it get pass through urlManager, and show me an empty array. If tha regular expression was wrong it should be stopped in the url manager, isnt it?

Anyway I’ve tried it, and i get the same response, and empty array…

any ideas???

What are you trying to do exactly?

Do you have any more URL rules?

What URL’s are you visiting and what’s the expected result?

I have emptied all my urlManagers, and this is the only thing i’ve got:




'urlManager'=>array(

			'urlFormat'=>'path',

			'showScriptName'=>false,

			'rules'=>array(

				'<lan:[a-z]{2,}>/' => 'site/index/',

			),

		),



And the url i’m visiting is this: “Myweb.com/es/”, and well i’m trying to get this GET parameter in my beingRequest, to set the language. I’ve got this working fine by POST, but for SEO optimization I need the language in the url.

I thought it was easy, coz i have a lot of urls, and all work fine, but this is before arrive at the controller and i don’t know if i can do this…

Why not override beforeAction() in your base Controller class instead?

Ok, I didn’t know about this, but, it suppose to do this in all my controllers, isn’t it? I’m going to work on this, but I thought to work in the beingRequest was a simple step an more easy…

Thanks again!

If you do it in your base Controller class, it will run for all of your controllers. That’s assuming that they all extend the Controller class of course.

Oh yes, after say these "nosense" i said before, i realized what you tried to say me. Sorry.

Now I Know what happend, yii pass through beingRequest before the urlManager, that is why i can’t get no GET parameter. I solved it with getUrl() from ChttpRquest, and it’s works perfectly.

Thanks again.