Forum Moderators: coopster
I am trying to make a photogallery to which i will be adding images. Currently I have the thumbnails arranged in a table-like format (i.e. fixed # of thumbnails per row). I'm expecting that as I add more images I'd need to spread the menus on different pages, with the newest images showing up on the first page. So obviously coding this in brute force html would be a hassle, because each added new image would mean I'd have to shift every image over by one in the table format.
(does that make sense? hmm... so if i had
6 5 4
3 2 1
and now adding a 7, it'd be like
7 6 5
4 3 2
1)
So I was wondering, how to write such a menu that'd a) keep the # of items per row constant while new ones are added to the top of the menu and b) automatically send the overflow to the next page?
The example I have in mind is css Zen Garden's page at
[csszengarden.com...]
where only 8 designs show up under the "select a design" menu. Or how most forums only keep a given number of threads on the same page and automatically adjust when new threads are added... Can someone tell me how to achieve that?
If it is indeed PHP, does anyone have any pointer on where to start learning?
[webmasterworld.com...] msg 4
is one example of dynamic table creation but that doesn't quite fit here as it does not limit the number of items
A few questions then
where are the images being puilled from? Is it from a certain directory, database, textfile?
I assume they are all in a certain directory at this point but your life might be a lot easier to store the image paths and any other info about them (descriptions, titles, etc) in a database and then you can select a certain number.
After putting the desired number of images on a page you could then you could pass values like 'next image' and 'images per page' to the same page and then use them to get the next bunch of images using those values in your mysql query.
other scripts that might be useful
[webmasterworld.com...] msg 29
an image uploader and thumbnail generator that uses mysql to store path info etc
there are a bunch of threads on previous / next functionality [google.com]
but back to the photo gallery issue at hand... i can see how basic php will certainly solve the thumbnail alignment problem, but with overflowing to new pages... since i am using my school's acct, i doubt i can set up a database (or is that still possible?) on the server, so maybe i'll just hard-code multiple menu pages and adjust the upper/lower limits manually with new updates... which seems feasible (at least now I don't have to shift all the images by hand). does that sound alright?