[eluser]laegnur[/eluser]
Hello
I'm still learning step by step, the workings of CodeIgniter. Now I'm triying this. I have a controller, that extends from my_controller class.
Code:
class Inicio extends MY_Controller
{
function Inicio('inicio')
{
parent::MY_Controller();
}
function index()
{
$this->load->view('view_inicio');
}
}
In My_controller class, I obtain some data from a model, that extends from my_model class (but it's other history... ), and I set a config item with this data.
Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class MY_Controller extends Controller
{
function My_Controller($star = 'inicio')
{
parent::Controller();
if(!$this->uri->segment(1))
{
redirect($star,'location');
}
$this->config->set_item('theme', $this->model_config->get('name','theme')->value);
}
}
/* End of file MY_Controller.php */
/* Location: ./application/libraries/MY_Controller.php */
I can access this config value from the first controller's view. But when I go to other controller (that not extend from MY_Controller class) clicking a link in the first controller's view, I can't acces this config value from this second controller's view.
Code:
<?php echo $this->config->item('theme'); ?>
Am I incorrectly setting configuration item?
With this I intend to only have to perform the query to the DB just once
P.d.: Sorry for my ugly english