posted
I'm having a problem with a scrolling image gallery of sorts. I have a php page that has one large gallery image and a bunch of thumbnails below it to change the corresponding larger picture. the thumbnails are all dynamically generated from a database.
I tried adding a script I found to allow the thumbnails to scroll left and right within a div of a set width to solve the problem of too many thumbnails on some pages. The problem is that it generates the images till it's the width of the div and then stops and doesn't scroll. The images still all function properly changing the corresponding gallery image, it just cuts them off at the end of the div and doesn't scroll at all.
I seperated the generated html code and dropped it into a seperate page and the scrolling works fine. I've been racking my brain and can't for the life of me figure out what's wrong. Is the fact that this is a php page interfering with the script somehow? That's the only thing I've been able to come up with as taking the generated html code and pasting it directly into another page works perfectly.
Here's an example page where it loads the pictures but doesn't scroll. The relavent code starts at the "<div id="galleryThumbnails">" line.
Here's the page I used to test the code seperately where the scrolling works fine.
Here's the javascript file that handles the scrolling.
I can post the relavent code here, but I figured it'd be easier to look at the pages directly, I'll post if anyone wants though. Any help would be greatly appreciated.
The one thing i noticed is that on my test page the visible images are constrained to the 500px width that the "motioncontainer" div is set to. While when I highlight the "motiongallery" div it seems to continue on past the end of motioncontainer to cover the length of the images. On the page from the actual site when I highlight the "motiongallery" div it's constrained to the 500px width of "motioncontainer". I'm assuming this is because the code isn't generated yet, so of course the div isn't populated with images like the the test page where I pasted the already generated html code. But how this is then relating to the non-scrolling once the code is generated, I'm not sure.
Posts: 8741 | Registered: Apr 2001
| IP: Logged |
posted
anybody? Even if it's just pointing me in the direction of some more helpful information or maybe another forum?
Posts: 8741 | Registered: Apr 2001
| IP: Logged |
posted
I too have a problem. I installed PHP to the computer and made .php file; it isn't automatically recognized, though. When I load it after adding the phpinfo() function, nothing happens. Any ideas?
posted
I taught myself some basic php this weekend, but not nearly enough to help either of you.
I didn't even install it -- just wrote a couple of .php files, uploaded them to my website, and tested there to make sure they ran.
Posts: 5462 | Registered: Apr 2005
| IP: Logged |
First, you have an illegal element in your HTML wrapping the images: nobr. Validating HTML is important to obtaining consistent javascript DOM manipulation. I know this is present in both places, but valid HTML is much easier to debug, too.
AFAICT your problem has nothing to do with the PHP.
The most likely candidate I have right now is something in the different javascript elements trampling each other. My suggestion is to go through your page and iteratively remove parts of it until the scrolling works. Start by trying removing the extra javascript.
Phanto: link? There are several possibilities. Your page is the following, correct?
posted
Installed the program? Describe in more detail the steps you took. While you can run php on a command line or such, it is almost always executed on a server. This means you must have a webserver such as Apache httpd installed, and that must have the appropriate capability to handle PHP set up.
posted
"did all the default values" isn't an explanation of the steps you took. Where did you put the file with the php code in it? What are you trying to do to view it?
Posts: 15770 | Registered: Dec 2001
| IP: Logged |
posted
I managed to get everything to work -- for the moment at least, through wamp, which seems to be working great. Thanks, fugu13!
What would be a really good way, imo, to learn the language is a bunch of problem sets. I.e., you see some material then are given a challenge or something based on that material. This is the method I used to learn Calculus and I found it satisfying and successful. Does anyone know of any websites that provide such a format?
They're a little more oriented towards Ruby, but can be done in any language. He provides test cases for Ruby, which is a great way of validating your code.
I don't know of any PHP code katas, though if you're having particular problems with any of them I'd be happy to create some basic test cases for it.
Posts: 15770 | Registered: Dec 2001
| IP: Logged |
quote:The most likely candidate I have right now is something in the different javascript elements trampling each other. My suggestion is to go through your page and iteratively remove parts of it until the scrolling works. Start by trying removing the extra javascript.
Thanks fugu. I did this and figured it out. And like most problems it ended up being simple and stupid.
Posts: 8741 | Registered: Apr 2001
| IP: Logged |