OK firstly hello i’m new to the forum and hope someone can help ;D
I’ll make this as simple as possible. well i hope i will.
sorry but the images wont upload nor will they as links so im just going to have to post them like this…
ok my lecturer today helped me build some links in php within an html doc… we are sticking by a brief to create a gallery with php css and of course the html… we CAN NOT edit anything but the css and one div class in the php gallery file.
you get the picture.
anyway… he typed in some code and i got most of it but feel a little bit overwhelmed with it as im looking at tuorials to complete the next phase and his coding practise is some-what different to most others.
the folder structure is as follows
i can not edit any of this. in the gallery/flowers folder there is a thumbs folder with the same image names… but obviously thumb sized.
the out come will HAVE to look like this
with lightbox standard plugin already linked in blah blah blah…
when you click each name
i.e people… places…
it will bring up the correct folder directory
but it must all stay within the gallery.php page ok so here is what i have and here is what i need help with… pleaseeeeee
[php]<?php
//directories
$dir = “images/gallery/”;
//i roughly understand the whole if statement below… but a simple explanation would be cool
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
//i know below removes the directory roots
if($file != “.” AND $file != “…” AND $file != “.DS_Store”){
//below confuses me i do not understand what this array does
$gallerynames[] = $file;
}
}
closedir($dh);
}
}
echo “
”;
//again below makes little sense
foreach ($gallerynames as $key=>$value){
echo “<a href=“gallery.php”>$value\n”;
}
?>[/php]
the dh variable i feel comes from knowhere and leaves me confused… he also said to call the images from the directory… copy and paste the code and tinker with it… ive tried this to no avail… i get the white screen of death…
so please could someone explain what he has done here… and what my next step to producing this would be.
if its not to much trouble of course