View Full Version : Modded PHP Photo Album script

09-28-2008, 05:33 AM
Hey guys I'm currently trying to mod this PHP Photo Album script (http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm) script so that I can click my menu and have my final page show in my content div. It all works separately right now, however it can't seem to work together in separate div on the same page. Here is my link to the page please look at my code (a bit messy) and please help me find a solution...

Help... (

09-28-2008, 11:28 AM
It doesn't do anything right now, and I get this error in FF:

Error: ajaxpage is not defined
Source File: javascript:ajaxpage('bio.html',%20'display');
Line: 1

You must have the resource script(s) on or linked (via external script tags) to your page or else they will not work.

In other words, this (from your source code):

<script src="ajax.js" type="text/javascript"></script>

points to a missing file (404 not found).

09-28-2008, 02:53 PM
opps uploaded the file now, but still doesnt work..

09-28-2008, 05:09 PM
The files you are trying to load, like:

are 404 not found because they are in the parent folder.

Even when you get this worked out, something like:

<li><a href="javascript:ajaxpage('../asia.php', 'display');">Asia</a></li>

I can tell you that what you are trying to do, load the PHP Photo Album script, will not work. Scripts on remote pages loaded via AJAX do not run. Some scripts are fairly easily adapted to this situation, but since PHP Photo Album makes extensive use of writing to the page as the page is loading, it would need to be extensively rewritten to even have a chance of working in an AJAX environment. So you should use an iframe, possibly an object tag, or even a frameset to load in the external PHP Photo Album pages.

09-28-2008, 06:05 PM
hmm i guess that's really what i need to do any links to how I would be able to use an iframe code? I was really trying not to use an iframe haha..

But for better visuals this is what I'm trying to do... this link here (

09-28-2008, 06:47 PM
You can do that (what you have on your new demo) without AJAX, and without innerHTML. Just change the src attribute of the image tag.

To answer your other question, to use iframe - You can put an iframe on your page and link to it, example:

<iframe name="display" src="some.htm" width="500" height="400" frameborder="0"></iframe>

<a href="someother.htm" target="display">Some Text</a>

09-28-2008, 08:26 PM
Thanks so far. the problem with the iframe is I have no control over how the content is styled inside it.. with the div I did. Since the content inside in img and not .html or .php, what can I do?

09-28-2008, 09:43 PM
The styles on or linked to a page displayed inside an iframe will control how it is displayed.

09-28-2008, 11:03 PM
the problem is that I cant link a style to an image being display within an iframe

the only way is to take each image and turn them into an html page and insert the css, but i have hundred of images, hence the initial rejection of iframes.

09-29-2008, 12:24 AM
The suggestion to use an iframe was for displaying a page with a script like PHP Photo Album on it as an external page. If you no longer need a script to function on the external content, if all you are doing is importing an image, what you had is fine, either AJAX, or the innerHTML thing on your second example you posted.

I'm no longer clear about what you are trying to accomplish.

09-29-2008, 02:39 AM
for some reason the image didnt appear.

09-29-2008, 03:16 AM
Can you take a look at the complete site now? Here it is. ( I just want the thumbnail page (asia.html) have the thumbnails link to a bigger version of themselves in the same div (display). But in my case asia.html won't show up in "display" div. I know you explained it, but the iframe won't work when my thumbnails link to themselves because the css style wont affect an img alone. That's the problem right now...

09-29-2008, 04:46 AM
but when I click on my menu it doesn't show, in particular "Asia" it doesn't show in the div "display"

09-29-2008, 07:09 AM
As I say the PHP Photo Album will not load via AJAX. The page (asia.html) is loading, but the script is not. Even if it loaded, if you clicked on a thumbnail, it would take over the entire page without any formatting of the larger image, so the iframe would actually be an improvement on that, but still not an ideal solution.

The funny thing is that if you had a true PHP gallery*, one with no javascript required to layout the thumbnails, that would load via AJAX (or not even require AJAX if you don't mind the page reloading to show different sets of thumbnails), and then you could use a javascript like Lightbox to display the larger images. But their size (dimensions) would be an issue. They could still be launched into the window, at that point most browsers would resize them to fit the window, but without formatting. And when the user hits back, the AJAX loaded content would no longer be there, unless a cookie were involved - unreliable though.

If you want this to look professional, you should consider editing your images so that they are more manageable dimension wise. Look into getting a true PHP gallery* and using something like Lightbox (v2.04 could be real good for this) for the enlarged images.


This one looked particularly good:


10-03-2008, 04:49 AM
Hey John, I just wanted to thank you for all your help. It gave me encouragement to keep on coding and fiddling til I got it right. I've got it right now for both safari and firefox for pc and mac. Thats an amazing accomplishment for me. Here is the final product with not much content yet... http://1013mm.com/

Now just one more question if you can answer, on safari, my vertical photos scale to fit my browser screen however on firefox it cuts off my photo and doesn't scale it, is there a way to fix it? Feel free to snoop around my code...