Vasilli
08-07-2003, 07:47 PM
I am trying to create an array of files in a directory, the code i have so far is as follows. What i am trying to do is make an array of the files, and then post them to the screen in lots of three (3 files to a line, i will place them into cells eventually). I have no problems with the code, it posts them to the screen, however it dosn't take any notice of the line which tells it to, after 3 entries, insert 2 <br>. can anyone tell me why?
Thankyou in advance
Jono
$sImageDir = 'path/to/files';
if (is_dir($sImageDir)){
$vOpenedDir = opendir($sImageDir);
while (($file = readdir($vOpenedDir)) != false) {
$sDirItem = $sImageDir. $file;
$sIgnoreList = $sDirItem != $sImageDir."." && $sDirItem != $sImageDir."..";
if ($sIgnoreList){
$iFile = array($file);
for($file = 0; $file < count($iFile); $file++)
{
if ($file % 3 == 0 && $file != 0) echo "<br><br>";
echo "<img src=". $sImageDir . $iFile[$file] ." width=\"130\"><br>";
//echo $iFile[$file] ."<br>";
}
}
}
}
closedir($vOpenedDir);}
Thankyou in advance
Jono
$sImageDir = 'path/to/files';
if (is_dir($sImageDir)){
$vOpenedDir = opendir($sImageDir);
while (($file = readdir($vOpenedDir)) != false) {
$sDirItem = $sImageDir. $file;
$sIgnoreList = $sDirItem != $sImageDir."." && $sDirItem != $sImageDir."..";
if ($sIgnoreList){
$iFile = array($file);
for($file = 0; $file < count($iFile); $file++)
{
if ($file % 3 == 0 && $file != 0) echo "<br><br>";
echo "<img src=". $sImageDir . $iFile[$file] ." width=\"130\"><br>";
//echo $iFile[$file] ."<br>";
}
}
}
}
closedir($vOpenedDir);}