> <?php
> function incl_common()
> {
> global $modroot; //modroot is defined as http://localhost/modules in a
settings file
>
> echo "<br>$modroot from included"; //this echos
"http://localhost/modules" properly
>
>
> //the below throws the error, OpenDir: No such file or directory
(error 2) in (this function file name)
> //but I can replce the $modroot/common with a hard-coded path and it
works fine.
>
# Echo out exactly what you are passing to opendir().
# Try tacking on a "/" at the end?
$fullpath = "$modroot/common/";
echo "fullpath is $fullpath<BR>\n";
$handle=opendir($fullpath);
> while ($file = readdir($handle))
> { //load files in $directory into array
> if ($file != ".." && $file != ".")
> {
> $files_to_include[count($files_to_include)] = $file;
> }
> }
>
> //clean up and sort
> closedir($handle);
> if (is_array($files_to_include))
> {
> while (list ($key, $val) = each ($files_to_include))
> {
> include "$modroot/common/$val";
> }
> }
> }
> incl_common();
> ?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]