View Full Version : Loading first image in array into a div on same page

07-09-2008, 01:13 PM
1) Script Title: DD PHP Photo Album script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm

3) Describe problem: Excellent script which does everything except one final thing. I have the links load in the same page with the use of a div ID "targetdiv"
and I would like to load the first image in the array/thumb list when the user lands on the page.

I found this thread alluding to an answer but when I tried it it doesnt appear to work: http://www.dynamicdrive.com/forums/showthread.php?t=25491&highlight=php+photo+album+image

Any help would be greatly appreciated.

07-09-2008, 03:54 PM
Oh, it works alright. However, you may need to use a little javascript to pull the first image from the galleryarray array if you don't already know what it will be. This would of course have to be done after the PHP Photo Album script has sorted the galleryarray array, and after the targetdiv division is parsed by the browser. And, depending upon how you are populating the targetdiv division, you should probably just use that same method.

But if you know what the first image will be, and you are populating the targetdiv by overwriting its innerHTML, you can just hard code the image in there.

Please post a link to the page on your site that contains the problematic code so we can check it out.