Welcome Guest, Not a member yet? Register   Sign In
Dynamic header & nav menu: how to handle them?
#2

[eluser]Unknown[/eluser]
Hello,

One way you could do this is to make a MY_Controller file and in the contructor have it run the query and assign it to a variable like so:

Code:
class MY_Controller extends CI_Controller
{
    function __construct()
{
          
  parent::__construct();
                $this->load->model('headermodel');
  $this->headerstuff = $this->headermodel->get_header_features();
}
}

You would then extend all your controllers to use My_Controller like so:
Code:
class Yourcontroller extends MY_Controller {

}

You can then access the stuff in headerstuff like so if your model sends it back as needed:
Code:
$this->headerstuff ['someheaderpart']

This is how I would approach it. They may be another way that is easier but this is how I make my configuration options available in all controllers.

I hope this helps.

Regards,
Ray


Messages In This Thread
Dynamic header & nav menu: how to handle them? - by El Forum - 07-25-2012, 11:16 PM
Dynamic header & nav menu: how to handle them? - by El Forum - 07-25-2012, 11:59 PM
Dynamic header & nav menu: how to handle them? - by El Forum - 07-26-2012, 02:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB