I need help letting users know there are no items available.
What i have is a page that shows the contents of a directory on the server. But if there is nothing on the directory then show there is nothing in text.
Here is code that i have so far:
$images = "../images/gallery/male/"; # Location of small versions
$height = 74; //height for each thumbnail
$width = 74; //the width for each thumbnail
$border = 0; //border for each image
$cols = 10; # Number of columns to display
$altTag = "Male Model Photos"; //give it an alt tag
if ($handle = opendir($images)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != rtrim($big,"/")) {
$files[] = $file;
}
}
closedir($handle);
}
$colCtr = 0;
if($images == 0 ){echo"nothing";}else{
echo '<table width="800" cellspacing="0" cellpadding="5" id="Gallery">';
foreach($files as $file)
{
if($colCtr %$cols == 0)
echo '
<tr>';
echo '
<td>
<a href="' . $images . $file . '" alt="' .$altTag.'">
<img src="' . $images . $file . '" height="'.$height.'" width="'.$width.'" border="'.$border.'"/>
</a>
</td>';
$colCtr++;
}
echo '</tr></table>' . "\r\n";
}
Anyway, can anyone help me?
What i have is a page that shows the contents of a directory on the server. But if there is nothing on the directory then show there is nothing in text.
Here is code that i have so far:
$images = "../images/gallery/male/"; # Location of small versions
$height = 74; //height for each thumbnail
$width = 74; //the width for each thumbnail
$border = 0; //border for each image
$cols = 10; # Number of columns to display
$altTag = "Male Model Photos"; //give it an alt tag
if ($handle = opendir($images)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != rtrim($big,"/")) {
$files[] = $file;
}
}
closedir($handle);
}
$colCtr = 0;
if($images == 0 ){echo"nothing";}else{
echo '<table width="800" cellspacing="0" cellpadding="5" id="Gallery">';
foreach($files as $file)
{
if($colCtr %$cols == 0)
echo '
<tr>';
echo '
<td>
<a href="' . $images . $file . '" alt="' .$altTag.'">
<img src="' . $images . $file . '" height="'.$height.'" width="'.$width.'" border="'.$border.'"/>
</a>
</td>';
$colCtr++;
}
echo '</tr></table>' . "\r\n";
}
Anyway, can anyone help me?