Simple gallery

Out of context: Reply #3

  • Started
  • Last post
  • 3 Responses
  • dc0

    i've done quite a few of these.

    i'd recommend using javascript ("the web developers friend").

    all you need to do is have a function that draws out your gallery, and accepts two arguments - the number of images in the gallery, and the path to the gallery.

    this function is written in an external js file, and included on every page that you want a gallery to be displayed. this way, you only have to write it once!

    say you have a folder called "christmas" whihc has 27 images. on your christmas.html page you call the function:

    drawGallery("christmas",27)

    in your external js file, you have your function which says something like:

    function drawGallery(path,num){

    for(i=0;i<num;i++){
    document.write('');
    }

    }

    and volia, this writes out the 27 images in the folder /images/christmas/.

    obviously you can change it around so that it writes it out in a table, has a link to open the image up, etc, etc. its simple, and you only need to touch it once.

View thread