Re: RE: help, weird include problem with functions

From: Date: Thu, 09 Aug 2001 19:29:27 +0000
Subject: Re: RE: help, weird include problem with functions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-62067@lists.php.net to get a copy of this message
> <?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(); > ?>

« previous php.general (#62067) next »