Welcome Guest, Not a member yet? Register   Sign In
Loading core controller as well as composer libraries
#4

There are other ways to make this work. HERE is a page that discusses all the variations.

I am not a fan of putting more than one class in a file but it does work. I prefer using the "hooks" method as described on the linked page.

You can put your autoload into config.php and fix the conflict problem with simple changes.

PHP Code:
function my_autoloader($class)
{
 
  if (strpos($class'CI_') !== 0)
 
  {
 
      if (file_exists($file APPPATH 'core/' $class '.php'))
 
      {
 
          include $file;
 
      }
 
      elseif (file_exists($file APPPATH 'libraries/' $class '.php'))
 
      {
 
          include $file;
 
      }
 
  }
}

spl_autoload_register('my_autoloader'); 

By using spl_autoload_register() you allow multiple autoload functions to live in harmony - including the composer autoloader.
Reply


Messages In This Thread
RE: Loading core controller as well as composer libraries - by dave friend - 06-14-2018, 12:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB