Welcome Guest, Not a member yet? Register   Sign In
Tip: Sick of get_instance()?
#7

[eluser]meglio[/eluser]
My solution is to use this class (application/libraries/Librarybase.php)

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Librarybase
{
    function __construct()
    {
        $this->CI =& get_instance();
    }
    
    protected $CI;
}

Then I'm just using this as a base class:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pathes extends Librarybase
{
public function anymethod()
{
  // here you have access to $this->CI
}
}


Messages In This Thread
Tip: Sick of get_instance()? - by El Forum - 04-08-2009, 08:23 AM
Tip: Sick of get_instance()? - by El Forum - 04-08-2009, 08:43 AM
Tip: Sick of get_instance()? - by El Forum - 04-08-2009, 08:55 AM
Tip: Sick of get_instance()? - by El Forum - 04-08-2009, 09:14 AM
Tip: Sick of get_instance()? - by El Forum - 04-08-2009, 09:32 AM
Tip: Sick of get_instance()? - by El Forum - 04-08-2009, 09:54 AM
Tip: Sick of get_instance()? - by El Forum - 04-16-2009, 07:56 AM
Tip: Sick of get_instance()? - by El Forum - 04-16-2009, 08:42 AM
Tip: Sick of get_instance()? - by El Forum - 04-16-2009, 08:47 AM
Tip: Sick of get_instance()? - by El Forum - 04-17-2009, 04:53 AM
Tip: Sick of get_instance()? - by El Forum - 04-17-2009, 07:56 PM
Tip: Sick of get_instance()? - by El Forum - 04-17-2009, 11:33 PM
Tip: Sick of get_instance()? - by El Forum - 04-19-2009, 07:04 AM
Tip: Sick of get_instance()? - by El Forum - 04-20-2009, 03:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB