Ok, one more question for the day 🙂
Structure:
WWW
|_Admin_Item_Add.php
|_Class
| |_class.php
| |_itemDbAlter.php
| |_itemFunction.php
|
|_inc
|_html
|_index.php
Admin_Item_Add.php has this code in it:
include("./Class/class.php");
class.php had this code in it:
$d = dir("./");
$block = array(".", "..", "class.php");
while (false !== ($entry = $d->read())) {
if(!in_array($entry, $block))
{
include("$entry");
}
}
$d->close();
What I want to do is be able to add different files to the Class directory and have the class.php dynamically include them.
Then I want to be able to include the class.php from anywhere and thus having all my classes (files) included at the same time.
If I call the class.php file by itself, it seems to include fine (no warnings or errors)
If I call the Admin_Item_Add.php file, I get several errors like cannot initiate class and some other things that make it seems like the code from class.php is also trying to include the files from the WWW directory because it is included from that directory.
Is there a way to get this to work?