Det virker ikke.
For lige at opsumere, lige nu ser det ud som følger:
Default.php
$dir = "./pictures_thumbnails/";
$gallery = "";
// List directories in the pictures folder
foreach(scandir($dir) as $item)
{
if (!is_dir($item))
{
$gallery = $gallery . "<li><a href='javascript:void(0);' class='gallery' value='".$item."'>" . $item . "</a></li>";
}
}
gallery.php
<?php
//Lidt sikkerhed på din query.
$name = $_GET['name'];
$dir = '../pictures_thumbnails/' . $name . '/';
$gallery = "<h1>$name</h1><div><table>";
$count = 0;
$explode = explode(".", $item);
$files = scandir($dir);
shuffle($files);
foreach($files as $item)
{
if (!is_dir($item))
{
$explode = explode(".", $item);
if (($count % 5) == 0)
{
if($count == 0)
{
$gallery = $gallery .
"<tr>
<td>
<a href='http://www.kp-foto.com/pictures/" . $name . "/" . $item . "' rel='lightbox[gallery]' title='" . $explode[0] . "'>
<img src='http://www.kp-foto.com/pictures_thumbnails/" . $name . "/" . $item . "' id='gylle'/>
</a>
</td>";
}
else
{
$gallery = $gallery .
"</tr>
<tr>
<td>
<a href='http://www.kp-foto.com/pictures/" . $name . "/" . $item . "' rel='lightbox[gallery]' title='" . $explode[0] . "'>
<img src='http://www.kp-foto.com/pictures_thumbnails/" . $name . "/" . $item . "' id='gylle'/>
</a>
</td>";
}
}
else
{
$gallery = $gallery .
"<td>
<a href='http://www.kp-foto.com/pictures/" . $name . "/" . $item . "' rel='lightbox[gallery]' title='" . $explode[0] . "'>
<img src='http://www.kp-foto.com/pictures_thumbnails/" . $name . "/" . $item . "' id='gylle' />
</a>
</td>";
}
$count++;
}
}
$gallery = $gallery . "</table></div>";
echo $gallery
?>
gallery.js
jQuery(document).ready(function(jQuery){
jQuery("a.gallery").click(function(){
var url = "http://www.kp-foto.com/subsites/gallery.php?name=";
var text = $(this).text();
var head = $("#content h1").text();
jQuery("#content").load(url + text);
if(text == head){
$(this).addClass('red');
}else{
$(this).removeClass('red');
}
});
});