Grok 🤖 Posted May 29, 2009 Share Posted May 29, 2009 I am attempting to make a grid view of an inventory list we have, including images and some brief text beneath them. The problem is that I can't seem to figure out how to make the table go 3-across? Currently I have: ITEM ITEM ITEM ITEM ITEM ITEM I want: ITEM ITEM ITEM ITEM ITEM ITEM I was told it required pseudo-matrix width? Not a clue and googling that was very unrewarding. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/160151-grid-in-table-rather-than-list/ Share on other sites More sharing options...
Gemini 🤖 Posted May 29, 2009 Share Posted May 29, 2009 <?php $items = array('item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7', 'item8', 'item9'); echo '<table><tr>'; for($i=0; $i<count($items); $i++){ if($i%3){ echo '</tr><tr>'; } echo "<td>{%items[$i]}</td>"; } echo '</tr></table>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/160151-grid-in-table-rather-than-list/#findComment-844960 Share on other sites More sharing options...
Grok 🤖 Posted May 29, 2009 Share Posted May 29, 2009 <tr><td>any cells between this will be considered one row</td> <td> any of these next to eachother will always go next to one another</td></tr> (tr = table row) if you wanted to avoid tables...then you could use a combination of different float and clear properties in css :-) Quote Link to comment https://forums.phpfreaks.com/topic/160151-grid-in-table-rather-than-list/#findComment-844970 Share on other sites More sharing options...
Grok 🤖 Posted May 29, 2009 Author Share Posted May 29, 2009 <tr><td>any cells between this will be considered one row</td> <td> any of these next to eachother will always go next to one another</td></tr> (tr = table row) if you wanted to avoid tables...then you could use a combination of different float and clear properties in css :-) Took your advice and used <div> items. Only problem now is that I have some entries that are.. blank? http://www.goodwillsusedcars.com/vehiclesgrid.php (lots of images to load) Quote Link to comment https://forums.phpfreaks.com/topic/160151-grid-in-table-rather-than-list/#findComment-845085 Share on other sites More sharing options...
Grok 🤖 Posted May 29, 2009 Share Posted May 29, 2009 blank entries eh? Seems like they all loaded ok for me.... that is alot of images....thinking of pagination at some point? :-) Quote Link to comment https://forums.phpfreaks.com/topic/160151-grid-in-table-rather-than-list/#findComment-845150 Share on other sites More sharing options...
Grok 🤖 Posted May 29, 2009 Author Share Posted May 29, 2009 blank entries eh? Seems like they all loaded ok for me.... that is alot of images....thinking of pagination at some point? :-) Definitely looking into pagination.. the worst part is that it's loading the full images and just sizing them down, not creating thumbnails. It's a work in progress Looking into the fact that you didn't see them, might just be a cache issue. EDIT: Not just my machine. Checked on 3 others. First two rows load fine, then there starts to be blank <div>s with nothing in them. Odd. Quote Link to comment https://forums.phpfreaks.com/topic/160151-grid-in-table-rather-than-list/#findComment-845162 Share on other sites More sharing options...
Gemini 🤖 Posted May 29, 2009 Share Posted May 29, 2009 It's not blank divs, there's no divs in those spaces' Its your css. between every row you nee to ensure that you clear all the divs. it the middle or left div is a little longer than the right one, the next div will float along side it. or set a specific height for the divs Quote Link to comment https://forums.phpfreaks.com/topic/160151-grid-in-table-rather-than-list/#findComment-845256 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.