Ciao, non riesco a far visualizzare le 3 foto che sono contenute nella directory /foto/
cosa sbaglio?
Codice PHP:
<?php
function dirList ($directory)
{
// create an array to hold directory list
$results = array();
// create a handler for the directory
$handler = opendir($directory);
// keep going until all files in directory have been read
while ($file = readdir($handler)) {
// if $file isn't this directory or its parent,
// add it to the results array
$name_divide=split('.',$file);
if ($file != '.' && $file != '..' && $name_divide[1]=='jpg')
$results[] = $file;
}
// tidy up: close the handler
closedir($handler);
// done!
return $results;
}
?>
Codice PHP:
<?php
//load all images
$images=dirList('/web/htdocs/www.sito.com/home/foto/');
if(count($images)>0):
$max=count($images);
$c=0;
?>
<tr>
<?php
foreach($images as $image){
if($c==0){
?>
<td width="283" height="166" align="center" bgcolor="#FFFFFF">[img]images/logo_trasp1.jpg[/img]</td>
<?php
}
$c++;
?>
<td width="293" align="right" >[img]<?php echo $images[0]; ?>[/img]</td>
<td width="10" bgcolor="#F3EFD0" ></td>
<td width="246" align="right" bgcolor="#F3EFD0" ><div class="b" style=" margin-left:0px; margin-top:0px; margin-right:0px; line-height:0px ">[img]<?php echo $images[0]; ?>[/img]</div><div class="b" style=" margin-left:0px; margin-top:10px; margin-right:0px; line-height:13px ">[img]<?php echo $images[0]; ?>[/img]</div></td>
<?php
if($c==3){
?>
</tr>
<?php
$c=0;
}
}
?>
<?php
endif;
?>