Welcome Guest, Not a member yet? Register   Sign In
Using PHP Session and the CI Session together
#1

[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


Messages In This Thread
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 03:15 AM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 05:19 AM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 05:32 AM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 05:37 AM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 05:50 AM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 06:49 AM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 07:19 AM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 01:44 PM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 01:51 PM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 01:54 PM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 02:16 PM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 02:28 PM
Using PHP Session and the CI Session together - by El Forum - 08-24-2010, 02:47 PM
Using PHP Session and the CI Session together - by El Forum - 08-25-2010, 03:08 AM
Using PHP Session and the CI Session together - by El Forum - 08-25-2010, 09:42 AM
Using PHP Session and the CI Session together - by El Forum - 08-25-2010, 12:34 PM
Using PHP Session and the CI Session together - by El Forum - 08-25-2010, 12:52 PM
Using PHP Session and the CI Session together - by El Forum - 08-25-2010, 01:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB