Forum Moderators: coopster
My website is all bought together using php, and calling so, to have these image galleries could be a problem.
Does anyone have an alternative to what I have, or does anyone have a soloution to enable me to call it.
Here's the code:
?
$NAMEFILE = "index.php"; //This files name.$dir = opendir("."); //Replace the dot with ./yourfolder or leave it as it is.
while ($file = readdir($dir)) {
if ($file!= "." && $file!= ".." && $file!= "$NAMEFILE") {
$time = filemtime("$file");
$data[$time] = "<a href=\"$file\" target=\"new\"><img src=\"$file\" width=\"150\" height=\"125\"></a>
";
}}krsort($data);
while(list($k,$v) = each($data)) { echo $v; }
clearstatcache();echo "";
?>
It's not giving me an error message no more. However, it has decided to call every image from my route directory into the gallery rather than that from the folder. =¦
The url to the gallery is
index.php?get=***/photography/other/test/index.php
I want all the images from the 'test' folder to appear. However, all the images from the route directory are.
you can't copy url's here i guess.. except this way [test.com ]
yeah brace them within pseudo-code (url in square brackets)
i think you should post the complete code of the page that is doing the trick along with absolute paths of the scripts.
The page html is as follows.
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<title>Website Title</title><meta tags>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<link rel="shortcut icon" href="favicon.ico"></head>
<body class=gbody>
<div class=container>
<div class=banner><img src="banner.jpg"></div>
<div class=navigation>
<? include('navigation.html');?>
</div><p>
<div class=content>
<?php
$pagina = $_GET[get];$StandaardMap = "";
$StandaardExtensie = ".php";
$StandaardBestand = "main.php";
$FoutBestand = "error.html";
if(!$pagina) { include("$StandaardMap$StandaardBestand"); }
elseif(strstr($pagina,"1") ¦¦ strstr($pagina,"0") ¦¦ strstr($pagina,"2")) { include("$StandaardMap$FoutBestand"); }
elseif(file_exists("$StandaardMap$pagina$StandaardExtensie")) { include("$StandaardMap$pagina$StandaardExtensie"); }
elseif(file_exists("$StandaardMap$pagina")) { include("$StandaardMap$pagina"); }
else { include("$StandaardMap$FoutBestand"); }
?></div>
<p>
<div class=navigation>
<? include('footer.php');?>
</div></div>
</body></html>
There. The image gallery code is posted in the original post of this thread.
you didnt post any paths but nevermind i see where the problem might be
What do you mean, 'paths'?
However, I tried your method, and I got the page but no images. Instead, just an error message:
Warning: opendir(/mrtom/photography/other/test): failed to open dir: No such file or directory in /home2/mrtom/public_html/mrtom/photography/other/test/index.php on line 15Warning: readdir(): supplied argument is not a valid Directory resource in /home2/mrtom/public_html/mrtom/photography/other/test/index.php on line 16
Warning: krsort() expects parameter 1 to be array, null given in /home2/mrtom/public_html/mrtom/photography/other/test/index.php on line 23
Warning: Variable passed to each() is not an array or object in /home2/mrtom/public_html/mrtom/photography/other/test/index.php on line 24
In the code, I changed the . to the following:
$dir = opendir("/mrtom/photography/other/test");
while ($file = readdir($dir)) {
when using opendir() you should specify an ABSOLUTE path - you specified a relative to /home2/ that's why you got the first error. it should be "/home2/mrtom/photography/other/test"
read this:
[php.net...]
and correct your script.