Re: [PHP] Auto Class loading

2004-11-17 Thread Jordi Canals
On Wed, 17 Nov 2004 19:17:13 -0200, Bruno B B Magalhães
<[EMAIL PROTECTED]> 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



Re: [PHP] Auto Class loading

2004-11-17 Thread Marek Kilimajer
Bruno B B MagalhÃes 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:

$this->$loadedclassname = new $loadedclassname;
Is it possible?
Yes.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Auto Class loading

2004-11-17 Thread Bruno B B Magalhães
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:

$this->$loadedclassname = new $loadedclassname;
Is it possible?
Regards,
Bruno B B Magalhaes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php