I am trying to recursively loop through a bunch of subdirectories and include the files within them instead of 'hardcoding' them in, the problem is if I do hardcode the include path it displays correctly but using the below code I keep getting 'failed to open stream: No such file or directory'. I have tried many different approaches and keep getting similar errors. If anybody has a suggestion of what or where I am going wrong I would appreciate it.
include path would be like: (/core/edit_object/border/border_radius.php);
filesInDir('core/edit_object');
function filesInDir($tdir) {
$dirs = scandir($tdir);
foreach($dirs as $file) {
if (($file == '.') || ($file == '..') || ($file == '.DS_Store')) {
} else if (is_dir($tdir.'/'.$file)) {
filesInDir($tdir.'/'.$file);
} else {
//echo '/'.$tdir.'/'.$file."<br>";
include '/'.$tdir.'/'.$file;
}
}
}