Jump to content

Is it possible to use two __autoload function in a script?


jeboy

Recommended Posts

No, you will get an error about 'cannot redeclare __autoload function'. What you can do however is make __autoload look in two locations. eg;

 

function __autoload($class)
{
  if (file_exists("local/includes/$class.php")) {
    require_once "local/includes/$class.php";

  } elseif (file_exists("../sitewide/includes/$class.php")) {
    require_once "../sitewide/includes/$class.php";
    
  }
}

 

Failing that, take a look at the standard php library's autoload implimentaion.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.