hvorfor går link ik rigtigt?
Hey allesammen!Hvis i lige tager et kig på www.boogieknights.dk
også går under galleri, også under det seneste galleri (Fætter Eskild) så vil i kunne se at den henter nogle billeder frem! Nederst på siden er det muligt at trykke videre for at se flere billeder! Den skal hente fra billede 33!
Når du trykker på linket går den til samme side, og ikke henter nye billeder frem!
Hvordan kan dette være!????
min kode::
<script language="javascript" type="text/javascript">
function popWin(file){
newWin=window.open("","ResizeBillede","width=300,height=200,status=no");
txt='<ht'+'ml><he'+'ad><ti'+'tle>Resize til billede<\57ti'+'tle><scri';
txt+='pt language="javascript" type="text/javascript">';
txt+='function resPic(){h=document.images[0].scrollHeight;';
txt+='w=document.images[0].scrollWidth;window.resizeTo(w+6,h+32);}<\57scri';
txt+='pt><\57he'+'ad><bo'+'dy style="overflow:hidden;';
txt+='border:0px;margin:0px"><i'+'mg onclick="self.close();" src="'+file+'" alt="Luk vindue" style="cursor: hand;" style="top:0px;left:0px;border:0px;';
txt+='" onload="resPic();"><\57bo'+'dy><\57ht'+'ml>';
newWin.document.write(txt);
newWin.document.close();
}
</script>
<?
//---- Settings Start ---\\
// Image Information
$imageWidth=100;
$imageHeight=75;
// Table Layout
$rows=8;
$cols=4;
//Image path
$libery="../../images/live/faetter_eskild_19_06/"; // remember to finish with /
// Settings Stop----------//
$viewNum=$cols*$rows;
if(!$firstImage){ // so it works if you just enter default.php and show the pictures without having to define the variables in the path
$firstImage=1;
}
function getImages($firstImage){
global $viewNum, $imageWidth, $imageHeight,$cols,$libery; //insures that the function gets the variables
$handle=opendir($libery); //opens directory
while($file=readdir($handle)){ // reads the directory
$extension=substr($file,-4); // gets the extension of the files
if(($extension == ".jpg") || ($extension == ".gif") || ($extension == ".png") ){ // checks for image files
$all[]=$file; //adds positive results to the archive
}
}
$colscounter=0; // variable that controls the tablebuilding system below
$firstImage=1; // variable that insures that the first image is being showed. Case: It looks best if the links begins with 1 but the array begins with 0
if(isset($all)){ // if array is set build the table
print "<table>";
for($i=$firstImage; $i < $firstImage+$viewNum; $i++){
if($all[$i]){ // checks for rinning dry of imges
if($i==$firstImage + $colscounter*$cols){ // if true: new row
$colscounter++;
print "<tr>";
} // add the image
print "<td><a href=\"#\" onclick=\"popWin('$libery$all[$i]');return false;\"><img src=\"$libery$all[$i]\" border=\"0\" width=\"$imageWidth\" height=\"$imageHeight\" alt=\"Click to Enlarge\"></a></td>";
}
else{ // stop if no more images
break;
}
}
print "</table><br>";
$num=count($all); //number of pictures in actual libery
makeList($num); // function to make the links list
}
else{
print "Der var desværre ingen billeder i dette bibliotek<br><a href='java script:history.back()'>Go Back</a>";
}
}
function makeList($num){
global $libery, $firstImage, $viewNum; //insures that the function gets the variables
$numLinks = $num / $viewNum; // finds the number og links to be maked
for($a=0; $a < $numLinks;$a++){
$start=$a*$viewNum+1; //adds 1 because then the links begins with ex. number 1-10 and 11-20 instead of 0-10 and 10-20
$finish=$a*$viewNum+$viewNum;
if($finish>$num){ // insures that the final link returns the right amount of pictures instead of to much
$finish=$num;
}
if(($firstImage >= $start) && ($firstImage < $a * $viewNum+$viewNum)){ // if true: makes no link because you already are on the page
print "$start - $finish</a> ";
}
else{ // makes the link
print "<a href='text01.php?libery=$libery&firstImage=$start'>$start - $finish</a> ";
}
}
}
?>
