• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.