Page 1 of 1

NEED HELP, MUTIPLE PAGES????

Posted: Tue Oct 21, 2003 5:59 am
by distorted
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.....

Code: Select all

<?php

# To add portability we'll make it into a function.
# and call it later on.

function GetIMGList($DIR) &#123;
  $handle = opendir("$DIR");
  $count = 1;
  while (false !== ($file = readdir($handle))) &#123;
    if ($count == 1000) &#123; 
      echo "<br>";
      $count = 1000;
    &#125;
    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++;
  &#125;
  closedir($handle);
&#125;

?>

<html>
<head>



<script language="Javascript"> 
function PopupPic(sPicURL) &#123; 
window.open( "popup.htm?"+sPicURL, "",  
"resizable=1,HEIGHT=200,WIDTH=200"); 
&#125; 
</script>

<script language="JavaScript">
nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta)&#123;
if (!document.all)
return
if (object != "&#1111;object]")&#123;
setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
return;
&#125;
clearTimeout(nereidFadeTimers&#1111;object.sourceIndex]);
diff = destOp-object.filters.alpha.opacity;
direction = 1;
if (object.filters.alpha.opacity > destOp)&#123;
direction = -1;
&#125;
delta=Math.min(direction*diff,delta);
object.filters.alpha.opacity+=direction*delta;
if (object.filters.alpha.opacity != destOp)&#123;
nereidFadeObjects&#1111;object.sourceIndex]=object;
nereidFadeTimers&#1111;object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects&#1111;"+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
&#125;
&#125;
</script>

<style>


body&#123;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;&#125;

</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?

Posted: Tue Oct 21, 2003 6:00 am
by distorted
oh and here is a link to my site if you wanna have a look at what i mean, http://www.distortedunion.tk