Re: Auto Class loading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 17 Nov 2004 19:17:13 -0200, Bruno B B Magalhães
<brunobbm@xxxxxxxxxx> wrote:

> Continuing the classes questions...
> 
> I have a class loader called 'load_core_class($class=''), but if $class
> equals to all I would like to load all classes in the core directory,
> include then AND start then this way:
> 

If you're on PHP-5 you could use the __autoload function, so when a
class is used will be automatically locaded. You should declare this
function before using any class:

function __autoload($classname)
{
    require_once('/path/to/classes/dir/' . $classname . '.inc');
}

Regards,
Jordi.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux