PHP - Use php to switch a part of the code when the page is rendered on a

Christopher

New member
persons browser? Ok, I'm trying to make a photo gallery/ album with php and lightbox. The album and gallery side are working perfectly however this is what I want to

accomplish....

Lightbox will use an images title tag as the images description (and i want to get this to work) but I'm running into the following problem with the code...

// This grabs all the images in the album the user requested
$handlenew = opendir($base."/".$get_album);
while (($images = readdir($handlenew))!==FALSE)

// This shows the images, it re-echos it for every picture found (I've left only the code you need to help me, took everything else out)
echo "<a href='$base/$get_album/$images' rel='lightbox[1]' title='$base/$text/$images' /><img src='$base/$thumbs/$images' height='140' width='135' /></a>";

So the problem comes with the TITLE tag. I've used $text instead here so it changes where its looking. Now IF i had a file named exactly the same as the

image (including its extension) in this folder ($text = a folder in the dir) the code would work..

BUT the problem is I save a file in there with the same exact name but a PHP extension, because what needs to happen is when it looks for this file it needs

to echo out some text (the discription of the image)

SO TO SUM IT UP - How can I make this.. title='$base/$text/$images' ..change $images file extension AFTER the code is generated in the ECHO?? OR I WAS

THINKING how can I have a php code that automatically looks at TITLE tags and forces the file extension to change to .php or .txt

REMEMBER all this code is being echo'd out, just like the print command...I have to echo it all together so all the images from the dir will show.

I appreciate any help or suggestions you may have...even alternate solutions that will work...

PS - I also thought something like a find and replace, so a php script will look for words inside [ ] or something, grab this info which would be something like photos/descriptions/filename.jpg and then alter the code to say photos/descriptions/filename.php or .txt and replace the stuff inside the [ ] with this info. The info would be the images description.
 
Back
Top