SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    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")
    );

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    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"]
    Without seeing how this is used in your Js I can't suggest much else.

  3. #3
    SitePoint Guru
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •