Distant_storm Posted December 24, 2007 Share Posted December 24, 2007 I am trying to make an image gallery type thing this is how it works Large image here < thumbnails here > i want it to retrieve 4 thumbnails and have links to the next 4 and previous 4 although i dnt want to use some mucky sql statment that i don't understand. unless someone can explani it. ive read the tutorial on it but its abit vague I have attempted but come to an end when i can't work out some logic to stop it retreivin photos when they don't exist. Quote Link to comment https://forums.phpfreaks.com/topic/83047-solved-pagination-but-not/ Share on other sites More sharing options...
Distant_storm Posted December 24, 2007 Author Share Posted December 24, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/83047-solved-pagination-but-not/#findComment-422646 Share on other sites More sharing options...
corbin Posted December 24, 2007 Share Posted December 24, 2007 I would probably do most of the client side stuff in javascript unless there's a lot of images (like.... over 50). Basicallly, I would make the script do this: <script language="javascript"> var images = new array(); images[0] = ['thumbs/thumb1.jpg', 'images/image1.jpg']; images[2] = ['thumbs/thumb2.jpg', 'images/image1.jpg']; </script> Then for the displaying, I would have a next link that would just replace the 4 display ones (after checking of course that there are four more). If you wanted to avoid all of the images being in the page, you could use ajax and base it on the last image id and category to get the next 4.... Anyway, I doubt this helped much, but it might help with some logic. Quote Link to comment https://forums.phpfreaks.com/topic/83047-solved-pagination-but-not/#findComment-422652 Share on other sites More sharing options...
Distant_storm Posted December 24, 2007 Author Share Posted December 24, 2007 See the problem i have is the X amount of images there can be any amount as there uploaded whenever. so there could be dead on 8 or there could be 6 Quote Link to comment https://forums.phpfreaks.com/topic/83047-solved-pagination-but-not/#findComment-422662 Share on other sites More sharing options...
Ken2k7 Posted December 24, 2007 Share Posted December 24, 2007 The easiest way I know how is to alter the URL with page numbers. Then on the query, use LIMIT. That's how I made my pagination system at least. Works perfectly. <?php $query = "SELECT table_column FROM table_name LIMIT limit_per_page, number_of_pages"; ?> You have to calculate before hand what the variables are. Simple division should work since you know how many pics you want on 1 page and you can get the total number of pics via the database. Quote Link to comment https://forums.phpfreaks.com/topic/83047-solved-pagination-but-not/#findComment-422674 Share on other sites More sharing options...
corbin Posted December 25, 2007 Share Posted December 25, 2007 Distant_Storm, that's why you would simply have blank (well, designed) spaces for when there's not a picture. Quote Link to comment https://forums.phpfreaks.com/topic/83047-solved-pagination-but-not/#findComment-422709 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.