probably simple problem, please help

i have added a component called vars.php into the components folder

i have added the line


'components'=>array(

...

		'vars'=>array(

			'class'=>'Vars',

		),

...

)

in the config/main.php file

the file vars.php looks like this


<?php

class Vars //extends CUrlManager

{

	public $variable;

	public function __construct()

	{

		$this->variable = test();

	}

	public function test() {

		return 'test';

	}

	

}

then in a view file i try to access it directly by


print_r(Yii::app()->vars->variable);

but yii throws a error


Fatal error:  Call to undefined function  test()

what am i doing wrong?

I think you must do:

public function __construct()

    {


            &#036;this-&gt;variable = [b]&#036;this-&gt;[/b]test();


    }


    or may be

public function __construct()

    {


            &#036;this-&gt;variable = [b]Vars::[/b]test();


    }

oh, yes both of those work!!

thanks!!