chiprivers Posted October 20, 2007 Share Posted October 20, 2007 I am wondering if somebody might be able to advise on the best way out to script the layout of my page. I want to display some thumbnail images in a grid of 4 columns across and upto 4 rows down. I will be displaying from the results of a query and with upto 12 records returned for each page display. How would be the best way to loop through the results so that I can display them in the desired way. Note also that I am trying to use CSS for layout the best I can instead of using tables. Quote Link to comment https://forums.phpfreaks.com/topic/74108-page-layout/ Share on other sites More sharing options...
pocobueno1388 Posted October 20, 2007 Share Posted October 20, 2007 You need to use pagination. There a plenty of tutorials out there for it. As for formatting them how you want, take a look at this post http://www.phpfreaks.com/forums/index.php/topic,95426.0.html Quote Link to comment https://forums.phpfreaks.com/topic/74108-page-layout/#findComment-374175 Share on other sites More sharing options...
Wes1890 Posted October 20, 2007 Share Posted October 20, 2007 If your talking HOW TO MAKE the images display 4x4, use for loops <?php for ($x=0; $x<4; $x++) { echo "<tr>"; echo "<td>pic</td>"; echo "<td>pic</td>"; echo "<td>pic</td>"; echo "<td>pic</td>"; echo "</tr>"; }?> Quote Link to comment https://forums.phpfreaks.com/topic/74108-page-layout/#findComment-374191 Share on other sites More sharing options...
pocobueno1388 Posted October 20, 2007 Share Posted October 20, 2007 If your talking HOW TO MAKE the images display 4x4, use for loops <?php for ($x=0; $x<4; $x++) { echo "<tr>"; echo "<td>pic</td>"; echo "<td>pic</td>"; echo "<td>pic</td>"; echo "<td>pic</td>"; echo "</tr>"; }?> It's going to take a little more work then that since they are pulling this data from the DB. If they were manually putting the images into the HTML, then your way would work fine. The link I posted above will show exactly how to format it from results from the database. Quote Link to comment https://forums.phpfreaks.com/topic/74108-page-layout/#findComment-374194 Share on other sites More sharing options...
chiprivers Posted October 20, 2007 Author Share Posted October 20, 2007 It's going to take a little more work then that since they are pulling this data from the DB. If they were manually putting the images into the HTML, then your way would work fine. The link I posted above will show exactly how to format it from results from the database. Thanks pocobueno1388, that was just what I was looking for. I'm fine with the pagination (I think), but just wasn't sure of best way to sort out the dynamic display in columns. Quote Link to comment https://forums.phpfreaks.com/topic/74108-page-layout/#findComment-374199 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.