Помощ за код

kriss

Registered
къде ми е грешката???(код за вадене на картинки от директория)
Код:
<?php 

$dir = "./wallpapers/";  
$picsOnRow = 3;  
$picsWidth = 120; 
$position = 2;  
$tableBorder = 5; 
$fileTypes = array("jpg", "gif", "png","bmp","jpeg");  

if($position==1)$pos=' align="left"'; 
if($position==2)$pos=' align="center"'; 
if($position==3)$pos=' align="right"'; 
echo "<table border=\"".$tableBorder."\"".$pos.">"; 
if ($handle = @opendir($dir)) { 
$fileCount = 0; 
while (false !== ($file = readdir($handle))) { 
if ($file != "." && $file != "..") { 

$ext = end(explode(".", $file)); 
if(in_array($ext, $fileTypes)){ 
if($fileCount == 0){ $fileCount = 1; echo "\n<tr>\n"; } 
if($fileCount == $picsOnRow) $closeTr = "</tr>\n<tr>\n"; 
echo '<td><a href="'.$dir.$file.'" rel="lightbox" class="gradualfader" ><img src="'.$dir.$file.'" width="'.$picsWidth.'" border="2"></a>'."</td>\n"; 
echo $closeTr; 
$closeTr = false; 
if($fileCount == $picsOnRow) $fileCount = 0; 
$fileCount++; 
} 
} 
} 
closedir($handle); 
} else echo "Can't read dir <b>( ".$dir." )</b>"; 
echo '</tr>'; 
echo '</table>'."\n"; ?> 
?php>

къде е грешката тук echo '</table>'."\n"; ?> (предпоследния ред)
 
<?php

$dir = "./wallpapers/";
$picsOnRow = 3;
$picsWidth = 120;
$position = 2;
$tableBorder = 5;
$fileTypes = array("jpg", "gif", "png","bmp","jpeg");

if($position==1)$pos=' align="left"';
if($position==2)$pos=' align="center"';
if($position==3)$pos=' align="right"';
echo "<table border=\"".$tableBorder."\"".$pos.">";
if ($handle = @opendir($dir)) {
$fileCount = 0;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {

$ext = end(explode(".", $file));
if(in_array($ext, $fileTypes)){
if($fileCount == 0){ $fileCount = 1; echo "\n<tr>\n"; }
if($fileCount == $picsOnRow) $closeTr = "</tr>\n<tr>\n";
echo '<td><a href="'.$dir.$file.'" rel="lightbox" class="gradualfader" ><img src="'.$dir.$file.'" width="'.$picsWidth.'" border="2"></a>'."</td>\n";
echo $closeTr;
$closeTr = false;
if($fileCount == $picsOnRow) $fileCount = 0;
$fileCount++;
}
}
}
closedir($handle);
} else echo "Can't read dir <b>( ".$dir." )</b>";
echo '</tr>';
echo '</table>"\n">';
?>
 

Back
Горе