im trying to echo all jpg image files in a folder. it works, but i dont have the line to show an error that the folder is empty written properly. it shows a php script error instead,
another problem is that i have one .txt file in the directory, this one will read the text for the certain page. the rest of the script will echo the jpg files. it might not echo zero files because of that text file
folder = cat the gategory name/title .txt file = the text for the page .jpg files = are the categories pictures
error is:
Warning: Invalid argument supplied for foreach() in /home/ranshow/domains/show.webking.co.il/public_html/modules/attractions.php on line 67 Gallery is empty, no pics to show 0
<div style="text-align: center;margin-top:25px;margin-bottom: 50px;">
<?
$count = "0";
foreach (glob("attractions/$cat/*.jpg") as $filename) {
$count++;
$files[] = $filename;
$filename = urlencode($filename);
}
if($count == "0") { echo "Gallery is empty, no pics to show"; }
else {
?>
<?
foreach ($files as $filename) {
?>
<a id="thumb1" href="img.php?img=<?=$filename;?>" class="highslide" onclick="return hs.expand(this)">
<img src="img.php?img=<?=$filename;?>" width="167" height="150" style="margin: 2px;d0b28c;padding:1px;border: 1px solid #c1c1c1;">
</a>
<?
}
?>
<?
}
?>
<br />
<i><?=$count;?> <?=$lang['attractions']['totalimages'];?></i>
<br />
</div>
how can i fix this? thanks :)