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?