You would have to change the function name "jumptopage" to something else as well. Use the following code where you want the second gallery to be displayed.
getpics2.php
Code:
<?
Header("content-type: application/x-javascript");
function returnimages2($dir=".") {
$patterns="\.(jpg|jpeg|png|gif|bmp)$";
$file = array();
$curimages=0;
if($handles = opendir($dir)) {
while(false !== ($theFile = readdir($handles))){
if(eregi($patterns, $theFile)){
$filedates=date ("M d, Y H:i:s", filemtime($theFile));
echo 'galleryarray2[' . $curimages .']=["' . $theFile . '", "'.$filedates.'"];' . "\n";
$curimages++;
}
}
closedir($handles);
}
return($file);
}
echo "var galleryarray2=new Array();" . "\n";
returnimages2();
?>
The code that goes in the body:
Code:
<script src="getpics2.php" type="text/javascript"></script>
<script type="text/javascript">
/***********************************************
* PHP Photo Album script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
var dimensions="3x2" //Specify dimension of gallery (number of images shown), such as 4x2, 3x1 etc
var imagepaths="http://www.mysite.com/gallery/" //Absolute path to image directory. Include trailing slash (/)
var href_targets="new" //Enter target attribute of links, if applicable
//Toggle popup link setting: popupsetting[0 or 1, "pop up window attributes" (if 1)]
var popupsettings=[1, "width=500px, height=400px, scrollbars, resizable"]
//Toggle image description: descriptionprefix[0 or 1, "Text to show" (if 1)]
var descriptionprefixs=[1, "Photo "]
//Sort images by date? ("asc", "desc", or "")
//"desc" for example causes the newest images to show up first in the gallery
//"" disables this feature, so images are sorted by file name (default)
var gsortorders="desc"
//By default, each image hyperlinks to itself.
//However, if you wish them to link to larger versions of themselves
//Specify the directory in which the larger images are located
//The file names of these large images should mirror those of the original
//Enter a blank string ("") to disable this option
var targetlinkdirs="http://www.mysite.com/largegallery/"
/////No need to edit beyond here///////////////////
function sortbydates(c, d){ //Sort images function
if (gsortorders=="asc") //sort by file date: older to newer
return new Date(c[1])-new Date(d[1])
else if (gsortorders=="desc") //sort by file date: newer to older
return new Date(d[1])-new Date(c[1])
}
if (gsortorders=="asc" || gsortorders=="desc")
galleryarray2.sort(sortbydate)
var totalslot=dimensions.split("x")[0]*dimensions.split("x")[1]
function buildimages(j){
var imagecompletepaths=(targetlinkdirs!="")? targetlinkdirs+galleryarray2[j][0] : imagepaths+galleryarray2[j][0]
var tempcontainers='<a href="'+imagecompletepaths+'" target="'+href_targets+'" onClick="return popuplinkfuncs(this)">'
tempcontainers+='<img src="'+imagepaths+galleryarray2[j][0]+'" title="'+galleryarray2[j][0]+' ['+galleryarray2[j][1]+']" />'
tempcontainers+='</a><br />'
tempcontainers+=(descriptionprefixs[0]==1)? descriptionprefixs[1]+(j+1) : ""
return tempcontainers
}
function jumptopages(pg){
var startpoints=(pg-1)*totalslot
var ys=1;
for (j=0; j<totalslot; j++){
document.getElementById("slides"+j).innerHTML=(typeof galleryarray2[startpoints+j]!="undefined")? buildimages(startpoints+j) : ""
}
while(document.getElementById("navlinks"+ys)!=null){
document.getElementById("navlinks"+ys).className=""
ys++
}
document.getElementById("navlinks"+pg).className="current"
}
var curimages=0
for (y=0; y<dimensions.split("x")[1]; y++){
for (x=0; x<dimension.split("x")[0]; x++){
if (curimages<galleryarray2.length)
document.write('<div id="slides'+curimages+'" class="slideshow">'+buildimages(curimages)+'</div>')
curimages++
}
document.write('<br style="clear: left" />')
}
function popuplinkfuncs(imgsrcs){
if (popupsettings[0]==1){
var popwins=open(imgsrcs.href, "popwins", popupsettings[1])
popwins.focus()
return false
}
else
return true
}
</script>
<!--Below HTML code refers to the navigational links for the gallery-->
<div id="navlinks">
<script type="text/javascript">
for (n=1; n<Math.ceil(galleryarray2.length/totalslot)+1; n++)
document.write('<a id="navlinks'+n+'" href="javascript:jumptopages('+n+')\">Page'+n+'</a> ')
document.getElementById("navlinks1").className="current"
</script>
</div>
Tested, and works. Hope this helps
Bookmarks