I am trying to print print this out in the html
<a id='riverwalk' style='display:none;' href='images/riverwalk/1.jpg' rel='prettyPhoto[riverwalk]'></a>
<a style='display:none;' href='images/riverwalk/2.jpg' rel='prettyPhoto[riverwalk]'></a>
<a style='display:none;' href='images/riverwalk/3.jpg' rel='prettyPhoto[riverwalk]'></a>
<a style='display:none;' href='images/riverwalk/4.jpg' rel='prettyPhoto[riverwalk]'></a>
But i want to do it pro grammatically and this is my code..but just not doing anything at all
$counter = 0;
$directory = "images/riverwalk"
$dir = opendir ("images/riverwalk");
while (false !== ($file = readdir($dir))) {
if ($counter == 0) {
echo "<a id='riverwalk' style='display:none;' href='images/riverwalk/$file' rel='prettyPhoto[riverwalk]'></a>";
$counter++;
}else{
echo "<a style='display:none;' href='images/riverwalk/$file' rel='prettyPhoto[riverwalk]'></a>";
$counter++;
}
}
does anything look off to anyone…i cant view the errors because i cant turn php errors on…any ideas
FIX: the issue was the a semicolon missing on the second line
Take a look at scandir() – it’s much easier to write and debug..
If that doesn’t work use is_dir() to check you’re pointing at the correct directory..