NEED HELP, MUTIPLE PAGES????
Posted: Tue Oct 21, 2003 5:59 am
ok here it goes, i have just tryed to redesign and programm my site pritty sucessfully, but i have an automated script which reads the dir for images and displayes them but i was wondering is there a way where it can read the dir, and if more then like 10 images are there it spawns a new page with another 10 on etc until all the images are shown. .e.g mutiple pages each with 10 images on, with a link at the bottom to the next page. i need this scrpit because if the pics in the dir keep growin as they are eventually they will be just one huge page with like 1000 pics.
Here is the code for the script so far.....
NE ideas?
Here is the code for the script so far.....
Code: Select all
<?php
# To add portability we'll make it into a function.
# and call it later on.
function GetIMGList($DIR) {
$handle = opendir("$DIR");
$count = 1;
while (false !== ($file = readdir($handle))) {
if ($count == 1000) {
echo "<br>";
$count = 1000;
}
if (!ereg("\.jpg|\.gif",$file)) continue; # Real images only please
echo "<a href="javascript:PopupPic('$DIR/$file')"> <img src="$DIR/$file" width="50" height="50" alt="$file" onmouseover="nereidFade(this,100,30,10)" style="FILTER: alpha(opacity=30)" onmouseout="nereidFade(this,30,50,5)"></A>\n";
$count++;
}
closedir($handle);
}
?>
<html>
<head>
<script language="Javascript">
function PopupPic(sPicURL) {
window.open( "popup.htm?"+sPicURL, "",
"resizable=1,HEIGHT=200,WIDTH=200");
}
</script>
<script language="JavaScript">
nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
if (object != "їobject]"){
setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
return;
}
clearTimeout(nereidFadeTimersїobject.sourceIndex]);
diff = destOp-object.filters.alpha.opacity;
direction = 1;
if (object.filters.alpha.opacity > destOp){
direction = -1;
}
delta=Math.min(direction*diff,delta);
object.filters.alpha.opacity+=direction*delta;
if (object.filters.alpha.opacity != destOp){
nereidFadeObjectsїobject.sourceIndex]=object;
nereidFadeTimersїobject.sourceIndex]=setTimeout("nereidFade(nereidFadeObjectsї"+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
}
}
</script>
<style>
body{scrollbar-face-color: #ffffff;
scrollbar-shadow-color: #ffffff;
scrollbar-highlight-color: #ffffff;
scrollbar-3dlight-color: #ded7d6;
scrollbar-darkshadow-color: #ded7d6;
scrollbar-track-color: #ffffff;
scrollbar-arrow-color: #ded7d6;}
</style>
</head>
<body bgcolor="#FFFFFF" link="#000000" vlink="#000000" alink="#000000" topmargin="0" marginheight="0" leftmargin="0" marginwidth="0">
<CENTER>
<?php
#Call it here:
GetIMGList("./");
?>
</body>
</html>NE ideas?