PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
im still stuck up wid this image gallery thingy..
i need to navigate within the gallery using back and next btns..but i dont have a database...one idea wud be to get the name of all the images in a folder in an array and then call it to display the next and back images..
you would be better served if you use session variables rather than read the contents of the folder every time the page is requested... create an array of image names... sort this array (alphabetically maybe).. on the values... keep a counter, again as a session variable to pass as offset value to the array of image names...
however, the new images uploaded during a particular user's session won't be available to him. So, if image addition/updation is more frequent on your site.. you can read the no. of images in the folder and compare that with the count of ur array of images.. if they don't match you can use push/pop in the array... & this explains the purpose of sorting of array based on image names.
PS: This is as far as I can go, pls don't ask for examples. I've given you enough pointers to get you started.
I like the way friendster do their image gallery. It browses all the image without going to the next page.
Kind of client-side effort
All the thumbnails have onclick event handler something like this
read all the files from your image dir. now loop through them doing the HTML as you go, put some sort of counter in the loop and then when it is in multiples of 5 (or however many images you want per page...) make it do the HTML to cut the page off and start a new one.
its just an idea, but if you wanna do it well you should read into using a pagination method; there are some good threads in this forum about it, just search.