SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Feb 17, 2007, 17:31 #1
- Join Date
- Sep 2003
- Location
- Northern California
- Posts
- 605
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
dynamically generating javascript snip from php/mysql or ajax?
I have a javascript based gallery script and the photo data (filename, w,h, caption) are hardcoded into the javascript. I'm unfamiliar with hackign javascript.
I would prefer to have the photo data come from either php/mysql (which I am familiar with) or an AJAX request. Below is the code snip I need to generate dynamically. Any thoughts on this are very appreciated.
Code:// Define each photo's name, height, width, and caption var photoArray = new Array( // Source, Width, Height, Caption new Array("3.jpg", "500", "280", "Door 3 - Click on the image to view previous or next image"), new Array("2.jpg", "425", "319", "Door 2 - Click on the image to view previous or next image"), new Array("1.jpg", "700", "260", "Door 1 - Click on the image to view previous or next image") );
-
Feb 17, 2007, 20:18 #2
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It would be a little easier to use array literals:
Code:["3.jpg", "500", "280", "Door 3 - Click on the image to view previous or next image"], ["2.jpg", "425", "319", "Door 2 - Click on the image to view previous or next image"], ["1.jpg", "700", "260", "Door 1 - Click on the image to view previous or next image"]
Cross-Browser.com, Home of the X Library
-
Feb 17, 2007, 22:23 #3
- Join Date
- Sep 2003
- Location
- Northern California
- Posts
- 605
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i think i've got a few ideas from a php hack someone posted on this website : http://www.maxkiesler.com/index.php/...jax_slideshow/
Bookmarks