1) CODE TITLE: Reads entire directory into the Simple Control Gallery for slideshow and add paypal options to include file info - no more hand coding...
2) AUTHOR NAME/NOTES: Dynamic Drive and DAB 'ill DO Ya' Creations
3) DESCRIPTION: This addition to the Simple Controls Gallery will now take the user input directory and read all images from it and display the entire slideshow of every photo in that directory. As an addition the same format is used to populate a Select Button for PayPal.
4) URL TO CODE:
http://tcstills.com/temp/new-slideshow-master.php and/or
http://tcstills.com/test.php
This page will be here for a few weeks at least... Then it will be incorporated into the whole site
Working sample... just copy and paste and be sure your pointing to the right js locations... Also need to point to directory to read pictures from too
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <script type="text/javascript" src="../slideviewer/jquery-1.2.6.pack.js"></script> <style type="text/css"> /*Make sure your page contains a valid doctype at the top*/ #simplegallery1{ //CSS for Simple Gallery Example 1 position: relative; /*keep this intact*/ visibility: hidden; /*keep this intact*/ } #simplegallery1 .gallerydesctext{ //CSS for description DIV of Example 1 (if defined) text-align: center; font-size:12px; padding: 2px 5px; } </style> <script type="text/javascript" src="../slideviewer/simplegallery.js"> /*********************************************** * Simple Controls Gallery- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more ***********************************************/ </script> <script type="text/javascript"> <?php $string=""; $fileCount=0; $filePath=$PATH.'images/'; # Specify the path you want to look in. $dir = opendir($filePath); while ($file = readdir($dir)) { if (eregi("\.jpg",$file)) { $string .= "[\"$filePath/$file\",\"\",\"\",\"$filePath$file\"],\n"; $fileCount++; } } ?> var mygallery=new simpleGallery({ wrapperid: "simplegallery1", //ID of main gallery container, dimensions: [600, 600], //width/height of gallery in pixels. Should reflect dimensions of the images exactly //in the image array below, first is the picture, then link then target if needed //Currently shows a first image for aestetics only. Following line is the entire slideshow from the //directory read above and the last image MUST be there so that the trailing comma ending the show is ommitted. imagearray: [ ["assets/1st.jpg","","","Introduction to Slideshow - Words in JPG to describe start-pause-left-right"], <?php echo $string ; ?> ["assets/last.jpg","","","Declares show over and about to repeat... Note no comma at end..."] ], autoplay: [true, 6000, 2], persist: false, fadeduration: 3000, oninit:function(){ }, onslide:function(curslide, i){ } }) </script> </head> <body> <div id="simplegallery1"></div> <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick" /> <input type="hidden" name="hosted_button_id" value="XXXXXXX" /> <table><tr><td> <input type="hidden" name="on0" value="Qty - Photo Sizes Available">Sample Purpose Only </td></tr><tr><td> <select name="os0"> <option value="1">Fill <option value="2">More Fill <option value="3">Still More Fill </select></td></tr><tr><td> <input type="hidden" name="on1" value="Select Image Number Here">Select Image Number Below</td></tr> <tr><td> <?php $paypalImgNum=""; $fileCounter1=0; $filePath1=$PATH.'images/'; # Specify the path you want to look in. $dir1 = opendir($filePath1); while ($file1 = readdir($dir1)) { if (eregi("\.jpg",$file1)) { $paypalImgNum .= "<option value=\"$filePath1$file1\">$filePath1$file1" ; $fileCounter1++; } } ?> <select name="os1"> <option>Select Your Image Here <?php echo "<br />$paypalImgNum" ;?> </select> </td></tr> </table> <input type="hidden" name="currency_code" value="USD"> <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img align="middle" alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </body> </html>



Reply With Quote


Bookmarks