[solved]
I am trying to build an image gallery from scratch. I have a directory of php files that are each the thumbnail for an album. Each with this structure:
<div class="pic">
<img id="albcov" onclick="showAlbum(this)" src="someimg.jpg"
Alt="albumtitle"
</div>
The relevant js:
function showAlbum(img){
var albumname=img.alt
document.getElementById("albcont").innerHTML = [executed contents of: albumname serverside php file];
}
How could I fetch the required file?
This php file will generate a list of thumbnails for the specified album. Which in turn will all the full images to be shown.
as I understand it it will require ajax of some sort.
edit: here is the code i am using now:
function showAlbum(img){
albumName = img.alt;
$('#albcont').load("/gallery/"+albumName+".php");
}
where albumname.php contains:
<p>
<?php foreach (glob("[albumname]/*.php") as $filename)
{
include ($filename);
}
?>
</p>
which includes all php files in that album which have structure:
<div class="galpic">
<img onmouseover="displayImage(this)" src="
someimg.jpg
" alt="
alt
" />
<p>
caption
</p>
</div>
and the JS for this is:
function displayImage(img) {
var imgname= img.src
var albumname= img.alt
document.getElementById("imgview").innerHTML ='<img src="'+imgname+'"/>';
}
example to view at lonjaselter.co.nr/gallery2.php