Welcome Guest, Not a member yet? Register   Sign In
Cannot Load Session/Model in Hook
#1

[eluser]jitterbug[/eluser]
I am trying to use session information in a hook. Here is the hook

Code:
class Template extends Controller {
      function Template() {
          parent::Controller();
          $this->load->helper('url');
          $this->load->helper('form');
          $this->load->model('userauth');
          $this->load->library('session');
      }

However similar code works fine in the default controller

Code:
class DefaultController extends Controller{

    function DefaultController (){
        parent::Controller();
        
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->model('userauth');
        $this->load->scaffolding('users');
    }}

This is the error I am getting

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Template::$session

Filename: hooks/template.php

Line Number: 17

So loading the session in a model when it was already autoloaded was a bad idea... However, it is still not recognizing session within the Template hook class.


Messages In This Thread
Cannot Load Session/Model in Hook - by El Forum - 01-08-2010, 06:04 PM
Cannot Load Session/Model in Hook - by El Forum - 01-08-2010, 08:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB