Welcome Guest, Not a member yet? Register   Sign In
How to check if a library exist in a controller?
#4

I understand that you want first to check if library loaded.
If not than you need to load, else you just use that library:

PHP Code:
public function some_other_method()
{
 
   if ( ! $this->is_lib($lib))
 
   {
 
       $this->load->library($lib);
 
   }
 
   // rest of your code
}

private function 
is_lib($lib)
{
 
   return is_object(@this->{$lib}) ?: FALSE;

Reply


Messages In This Thread
RE: How to check if a library exist in a controller? - by Tpojka - 04-29-2016, 05:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB