Question about php coding

Associate
Joined
21 Jun 2011
Posts
16
I have recently been learning how to code a photo gallery in php, that doesnt use a database. But i have come up against some problems. Whilst coding in dreamweaver it came up saying that there was an error on line 26 of the code which i have put an * against so you know which line it is. I cannot seem to see where i have gone wrong.

<html>
<head>
<script type="text/javascript" src"lightbox.js"></script>
</head>
<body>

<?php
$page = $_SERVER['PHP_SELF'];

//settings
$column = 5;

//directories
$base = "data";
$thumbs = "thumbs";

//get album
$get_album = $_GET['album'];

if(!$get_album)
{
echo "<b>Select an Album</b><p />";
$handle = opendir($base);
while (($file = readdir($handle))!==FALSE)
{
if (is _dir($base."/".$file) && $file != "." && $file != ".." && $file != $thumbs)
{
echo "<a href='$page?album=$file'>$file</a><br />";
}
}
closedir($handle);
}
else
{
* if (!is_dir($base."/".$get_album) || strstr($get_album,".")!=NULL || strstr($get_album,"/")!=NULL ||strstr($get_album,"\\")!=NULL)
{
echo "Album doesn't exist.";
}
else
{
$x = 0;
echo "<b>$get_album</b><p />";
$handle = opendir($base."/".$get_album);
while (($file = readdir($handle)) !==FALSE)
{
if ($file != "." && $file !="..")
{
echo "<table style='display:inline;'><tr><td> <a href='$base/$get_album/$file' rel='lightbox'><img src='$base/$thumbs/$file' height='100' width='100'></td></tr></table>";
$x++;

if ($x==$column)
{
echo "<br />";
$x = 0;
}
}
}
closedir($handle);

echo "<p /><a href='$page'>Back to Albums</a>";
}
}

?>

</body>
</html>

Cheers in advance guys for any help
Ryan
 
It just says that there is a syntax error on line 26, and that code hinting may not work until you fix this error. When i embed the file into another php document and upload it to my web domain it is just blank and shows nothing what so ever
 
Problem on line 26 is the space. Should be is_dir but you have is _dir. You have a * on line 35 which is also causing a syntax error :)
 
Cheers immsy, been looking at it for an age and didnt even clock it lol, and as regards to the * it was meant to go on line 26 but i obviously pasted it in the wrong place :( fail lol, all sorted and working now though so cheers :D
 
No problem, you working in dreamweaver or a similar text editor? Things like is_dir show up in blue and when there is a syntax error they just show up as black so its easier to spot.
 
Yeah working in dreamweaver and the only problem is that i am colour blind mate lol, so i can see that its different colours but just not tell properly what they are =/ lol
 
not sure how colour blind works and dreamweaver but i know notepad++ allows you select a colour theme. might be worth a shot as you may find ones that allow you to clearly see the difference in colours.
 
Back
Top Bottom