Welcome Guest, Not a member yet? Register   Sign In
Can't use $this->load->database() anywhere?
#5

[eluser]Tom Schlick[/eluser]
but for things such as libraries you should probably do the following so you dont have to use get_instance() in every single function...
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class WhateverClassNameYouGiveIt
{
    
    var $CI;
    
    function __construct()
    {
        $this->CI =& get_instance();
    }
    
    function whatever()
    {
        $this->CI->whatever_library->some_function_to_do_something();
    }
}


Messages In This Thread
Can't use $this->load->database() anywhere? - by El Forum - 04-09-2009, 04:31 PM
Can't use $this->load->database() anywhere? - by El Forum - 04-09-2009, 06:02 PM
Can't use $this->load->database() anywhere? - by El Forum - 04-09-2009, 06:12 PM
Can't use $this->load->database() anywhere? - by El Forum - 04-09-2009, 06:52 PM
Can't use $this->load->database() anywhere? - by El Forum - 04-09-2009, 07:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB