title: Loop DIV using php to show images
body: <p>How do I display all images in a folder on my page?</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div class="itemS"&gt;
      &lt;li&gt;&lt;div class="itemType"&gt;&lt;input type="image" src="image/blah1.jpg"/&gt;&lt;gt_descA&gt;Description here&lt;/gt_descA&gt;&lt;/div&gt;&lt;/li&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I want to use php to loop thru the images and display all of them along with the file name. But it doesn't work.</p>
  
  <pre><code>&lt;?php
  $folder = 'blah/';
  $filetype = '*.*';
  $files = glob($folder.$filetype);
  $count = count($files);
  for ($i = 0; $i &lt; $count; $i++) {
     echo "&lt;div class="itemS"&gt;
      &lt;li&gt;&lt;div class="itemType"&gt;&lt;input type="image" src="'.$files[$i].'"/&gt;&lt;gt_descA&gt;"substr($files[$i],strlen($folder),strpos($files[$i], '.')-strlen($folder))"&lt;/gt_descA&gt;&lt;/div&gt;&lt;/li&gt;
  &lt;/div&gt;";      
  }     
  ?&gt;
  </code></pre>