I changed the code to this;
[syntax=php]<?php
include 'core/init.php';
if (isset($_GET['album_id'])) {
$album_id = $_GET['album_id'];
$album_data = album_data($album_id, 'name', 'description');
echo '<h3>', $album_data['name'], '</h3><p>', $album_data['description'], '</p>';
$albums = get_albums();
$images = get_images($album_id);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div id="wrap">
<div id="sidebarleft">
<?php
if (isset($images)) {
foreach ($albums as $album) {
echo'<a href="view_album.php?album_id=', $album['id'], '"></a>';
}
foreach ($images as $image)
{
echo'<a href="view_album.php?album_id=', $album['id'],'&image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '"><img src="uploads/thumbs/', $image['album'], '/', $image['id'], '.', $image['ext'], '" title="" /></a><a href="delete_image.php?image_id=', $image['id'],'">x</a>
}
}else {echo 'Er zijn geen foto\'s in dit album';
}
?>
</div>
<div id="imagecontainer">
<div id="image">
<?php
if(isset($_GET['image_id'])){
$full_img = $_GET['image_id'];
echo'<a href="?image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',htmlentities($_GET['image_id']), '" title="" /></a>';
}else{
if(isset($_GET['image_id'])){
$full_img = $images[0];
print_r($images);
var_dump($full_img);
}
echo'<a href="?image_id=uploads/', $image['album'], '/', $image['id'], '.', $image['ext'], '">
<img src="',htmlentities($full_img),'" title="" /></a>';
}
?>
</div>
</div>
<div id="footer">
<?php
include 'template/footer.php';
?>
</div>
</div>
</body>
</html>[/syntax]
I put the $albums foreach loop separate from the $images foreach loop. It works not bad, there are only one thumbnail showing from one image instead of three thumbnails, when I click one a thumbnail the main image shows nicely up in the main image container. Only the thumbnail part is going to another $album['id']. Is there a solution to stay in the same album after I clicked on a thumbnail?
http://www.robcnossen.nl/view_album.php?album_id=7I experimented also with array_combine or array_merge ect. I don't think that there is a solution in it, but it is nice to see what it does.