Jump to content

__autoload function included in php help


briangroce
 Share

Recommended Posts

Hi there,

I'm trying to get a script to work in process wire that loads a class dynamically if that class is not found. Do you know if there is something I need to do in Processwire to get the function __autoload() {} to work correctly?

 Here is the code I am using that would include the class:

function __autoload($className){
     echo "<h1>called.</h1>";
     echo "<h2>".$className."</h2>";       
     $filePath = stuff/here.php;
        
         if(file_exists($filePath)){
             require_once $filePath;
             return;
         }
}

I'm putting the echo statement in there just to see if it is loading anything. I don't get anything. Any ideas?

Thanks guys!

http://php.net/manual/en/language.oop5.autoload.php

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...