Welcome Guest, Not a member yet? Register   Sign In
Auto load Library before all Controllers
#4

[eluser]Ty Bex[/eluser]
Thanks so much for your help. I should never be coding after a 16 hour work day.
I was editing a backup of my autoload.php

xwero
Quote:Instead of loading the libraries and helper in your custom library you better add them to the autoload file too. This way if you change from authentication library your other code doesn’t break.

They are in my autoload.php but I have to $CI =& get_instance(); im my library.. Don't I??
Code:
$autoload['libraries'] = array('database', 'email', 'validation', 'session', 'encrypt', 'l_auth_user' );

$autoload['helper'] = array('url', 'form', 'date', 'security' );

application/libraries/L_auth_user.php
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class L_auth_user {
    
    function check($check_level)
    {
        $CI =& get_instance();
        $CI->load->database();
        $CI->load->library('session');
        $CI->load->library('encrypt');
        $CI->load->library('validation');
        $CI->load->helper('form');    

        /* DO SOME STUFF */
    }


Messages In This Thread
Auto load Library before all Controllers - by El Forum - 12-03-2008, 10:48 PM
Auto load Library before all Controllers - by El Forum - 12-03-2008, 11:21 PM
Auto load Library before all Controllers - by El Forum - 12-04-2008, 12:46 AM
Auto load Library before all Controllers - by El Forum - 12-04-2008, 09:01 AM
Auto load Library before all Controllers - by El Forum - 12-04-2008, 12:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB