Log in

View Full Version : parse error



kosi
08-23-2007, 09:29 PM
Somebody please help out; I'm at my wits end with this one.

I'm getting a parse error message from my server:
Parse error: syntax error, unexpected T_STRING in [pathtofile] on line 137

This is line 137:

$pic_file = "zz_gallery/gallery_" . $max_pictures . ".php";


These are lines 134 - 160:

<?php

$pic_file = "zz_gallery/gallery_" . $max_pictures . ".php";

if (file_exists($pic_file)) {

$tmp = file_get_contents($pic_file);
foreach (range(0, $max_pictures-1) as $key) {
$uri = $pic = $picture_set[$key];
if (!$pic) {
$thumb = "<img src='/models/thumb.php5?uri=blank' height='125' width='100' border='0'/>";
} else {
$thumb = "<a href='$pic'><img src='/models/thumb.php5?uri=$pic' height='125' width='100' border='0'/></a>";
}
$tmp = str_replace("[$key]", $thumb, $tmp);
}
echo $tmp;

} else {

echo "<table cellspacing='15' cellpadding='0' border='0'>\n\t<tr>\n";
foreach ($picture_set as $pic) {
echo("\t\t<td><a href='$pic'><img src='/models/thumb.php5?uri=$pic' height='125' width='100' border='0'/></a></td>\n");
}
}

?>

I just can't figure out what the problem is!!!

djr33
08-23-2007, 10:35 PM
Weird. I don't see it either. Could there be a larger problem, like an open loop?

boogyman
08-24-2007, 01:02 AM
it looks like you have the correct syntax, but if you are using PHP5 you could also do


$pic_file = "zz_gallery/gallery_{$max_pictures}.php";

you should get the same error, though, but if you wanna try you can go for it.

as djr said, it could be an open loop, or possibly even an extra open bracket somewhere... the error occured on 137, and thus aborted, so really it would be better if we were to see lines 0-136 to let you know what's causing the error

kosi
08-24-2007, 01:56 AM
You were right; the issue was an open string on line 96. I wouldn't have thought to look up that far, lol. Thanks.

Twey
08-24-2007, 08:07 AM
if you are using PHP5 you could also doNot just PHP5; that also works on at least PHP4.