I use the Kohana 3.2 framework. I have one variable with a static string.
Code for index.php
controller:
class Controller_Index extends Controller_Template {
public function action_index()
{
$articles_ = Model::factory('index')->do_magic();
$view_content = View::factory('index/index')->set('query', $articles_);
$this->response->body(View::factory('template/index')
->set('page_title', 'Sākums')
->set('content', $view_content));
}
} // End Welcome
And code for Template controller (template.php
):
class Controller_Template extends Kohana_Controller_Template {
public $template = 'template/index';
public function before()
{
parent::before();
$config = Kohana::$config->load('common');
$this->template
->set('site_name', $config->site_name);
}
}
And my config file (common.php
)
return array (
'site_name' => 'reGative.id.lv',
)
I get the error: ErrorException [ Notice ]: Undefined variable: site_name
.
Where is the problem?