title: Flexslider image <li> dynamically generated by php. Trying to create captions using alt text
body: <p>I have a vanilla flexslider installation on my site.  The slider operates by cycling through list items in an unordered list.  You can add captions simply by adding a caption container after the list item.  This works well with hard coded images.</p>
  
  <p>The problem I am facing is that my site has multiple sections, with a different slide show for each section.  Instead of hard coding the li elements, I'm generating them with php, so that when a user visits a page, the php figures out which page the user is viewing, and passes that through to the slideshow.  The slideshow then finds the proper image directory and loads all of the images in that directory whether there be two or twenty.  It's much easier than hard coding each slideshow, and it works beautifully.</p>
  
  <pre><code>    &lt;?php
          $dh = "image/slideShows/$slideShow/";
          $images = glob($dh . "*.jpg");                       
          foreach($images as $image){
              ?&gt;&lt;li&gt;&lt;img src="&lt;?php echo $image;?&gt;" alt="caption text" /&gt;&lt;/li&gt;&lt;?php
          }
          closedir($dh);
      ?&gt;
  </code></pre>
  
  <p>I need to get flexslider to read the alt text for each dynamically generated image, and then place it in a caption container:</p>
  
  <pre><code>    &lt;p class="caption"&gt;The alt text should show up here.&lt;/p&gt;
  </code></pre>
  
  <p>I've tried using:</p>
  
  <pre><code>    $(window).load(function() {
        $('.flexslider').flexslider({
          animation: "fade",
          controlsContainer: "#slideShowContainer",
          start: function(slider) {
           $('.caption').html(this.alt);
          },
        });
      });
  </code></pre>
  
  <p>and playing around with flexslider's current.slide to no avail.  I've been searching on this all night and I can't seem to figure this one out.  I'm hoping someone here can provide the missing link for me.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT: I figured this out, and it was seriously a matter of over-complication.  All I had to do was call the EXIF data that I was using for the "alt" attribute inside of the caption.  I have no idea why it took me so long to realize this.  Thank you both for your help!</strong> </p>