[eluser]danmontgomery[/eluser]
You have a couple of options.
- Extend the controller class, call the code in the constructor of that base class so that it is automatically called whenever a controller extends the base class.
- Put it in the constructor of each controller that needs to call it.
Either way, the variable would need to be assigned to a class member, not a local variable.
Code:
class Home extends Controller {
function Home()
{
parent::Controller();
$this->pageinfo = $this->Pageload->getPage();
session_start();
}
function index()
{
$data['contact'] = $this->Contact->getAddress();
$data['load_js'] = array('jquery', 'reliant', 'googlemaps');
$this->load->view($this->pageinfo->template, $data);
}