title: if folder is empty echo message, if not show all jpg files
body: <p>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,</p>
  
  <blockquote>
    <p>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</p>
    
    <p>folder = cat the gategory name/title .txt file = the text for the page
    .jpg files = are the categories pictures</p>
  </blockquote>
  
  <p>error is:</p>
  
  <p>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</p>
  
  <pre><code>&lt;div style="text-align: center;margin-top:25px;margin-bottom: 50px;"&gt;
      &lt;?
      $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 {
      ?&gt;
      &lt;?
      foreach ($files as $filename) {
      ?&gt;
      &lt;a id="thumb1" href="img.php?img=&lt;?=$filename;?&gt;" class="highslide" onclick="return hs.expand(this)"&gt;
      &lt;img src="img.php?img=&lt;?=$filename;?&gt;" width="167" height="150" style="margin: 2px;d0b28c;padding:1px;border: 1px solid #c1c1c1;"&gt;
      &lt;/a&gt;
      &lt;?
      }
      ?&gt;
      &lt;?
      }
      ?&gt;
      &lt;br /&gt;
      &lt;i&gt;&lt;?=$count;?&gt; &lt;?=$lang['attractions']['totalimages'];?&gt;&lt;/i&gt;
      &lt;br /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>how can i fix this? thanks :)</p>