Welcome Guest, Not a member yet? Register   Sign In
Issue with hook and template library
#1

[eluser]xtremer360[/eluser]
I am coming across a weird error message that I've never come across before. When I load my login page I get the following error.

Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Login::$agent
Filename: libraries/Template.php
Line Number: 122

I am using Phil Sturgeon's template library for my codeigniter application. It is currently autoloaded. I've included the hook that I am using for my system because if I keep it I get the error message. If I comment it out then I don't get the error message. To the best of my knowledge there is no error with its 7 lines of code or the sys_prescript.php file.

application/config/hooks.php

Code:
$hook['pre_controller'] = array(
    'class'    => 'Sys_prescript',
    'function' => 'is_logged_in',
    'filename' => 'sys_prescript.php',
    'filepath' => 'controllers',
    'params'   => ''
);

application/controllers/sys_prescript.php

Code:
<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
class Sys_prescript extends CI_Controller {
    public function __construct() {
        parent::__construct();
    }

    public function is_logged_in()
    {
        $public_access = array('login', 'registration');    
        if (!in_array($this->router->fetch_class(), $public_access))
        {
            $user_id = $this -> session -> userdata('user_id');
            if (($user_id == FALSE) || (is_numeric($user_id) == FALSE) && (strlen($user_id) < 5))
            {
                redirect('login');
            }
        }
    }
}

application/controllers/login.php

Code:
&lt;?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
class Login extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this -> load -> model('user_login_model', 'login');
    }

    public function index()
    {
        $this -> template -> set_theme('saturn') -> set_layout(FALSE) -> build('admin/login');
    }
}



Messages In This Thread
Issue with hook and template library - by El Forum - 02-05-2014, 09:50 AM
Issue with hook and template library - by El Forum - 02-05-2014, 12:20 PM
Issue with hook and template library - by El Forum - 02-05-2014, 12:30 PM
Issue with hook and template library - by El Forum - 02-05-2014, 12:32 PM
Issue with hook and template library - by El Forum - 02-05-2014, 12:39 PM
Issue with hook and template library - by El Forum - 02-05-2014, 12:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB