Request Variable In Application Component

I am using a custom application component referenced in config/main.php and would like to use $_REQUEST variables as parsed from CUrlManager like so:











	'location' => array(

		'class' => 'application.components.LocationComponent',

		'urlVars' => array(

			'country'   => $_REQUEST['country'],

			'city'      => $_REQUEST['city']




Everything is working except $_REQUEST array is empty during the LocationComponent init() function.

Any suggestions?

Have you tried defining the variables before and then using them there as




you can also do this in your urlVars as what I understand is that you want to do jobs country specific.

You can do this in your init function of the location component as

public function init(){




Thanks for the reply.

I ended up removing the urlVars=>array() from config/main.php and removed ‘location’ from preloader.

    public function init () {


            isset($_REQUEST['country']) && isset($_REQUEST['city']) &&

            strlen($_REQUEST['country']) > 0 && strlen ($_REQUEST['city']) > 0

            ) { .... }


The next time Yii::app()->location was referenced it checked the $_REQUEST variable.