php - 360 grid -- Finish out row with odd number of records -


I'm trying to complete it with a 360 grid system:

From the database, It is working perfectly on the product of 4 products on the whole, but if there are fewer than 4 products in the category, then the design becomes messy up, because the device has not stopped properly. The problem is that sometimes - There are only 3 or fewer products in the line.

How do any of you accomplish this?

 For  ($ i = 0; $ I <$ countprod; $ i ++) {$ prevprod = $ products [$ i-1] ['name']; $ Curprod = $ products [$ i] ['name']; If ($ curprod! = $ Prevprod) {echo '& lt; Div class = "grid_12 alpha omega" & gt; & Lt; H2 & gt; $ Products [$ i] ['catname']. '& Lt; / H2 & gt; & Lt; / Div & gt; '; } If ($ i == 0) {echo ' 
'Image']; if ($ i% 4 == 3) {echo '
;' (title Sorry about, I did not know what this question is like :))

  $ I = 0; $ i & lt; $ countprod; $ i ++) {$ curprod = $ products [$ I] ['name']; if ($ curprod! = $ Prevprod) {If ($ close_div) echo '& lt; / div & gt;'; echo '& lt; div class = "grid_12 alpha omega" & gt; ; & Lt; h2 & gt; $ Products [$ i] ['cat name']. '& Lt; / h2 & gt; & lt; ($ I% 4 == 3) {echo' & lt; div class = "grid_3 alpha" & gt; ; ' $ Close_div = true;} otherwise ($ i% 4 == 3) {echo} '& lt; / div & gt; div class = "grid_3 omega" & gt; $$ close_div = true;} Other {echo & lt; / div & gt; & lt; div class = "grid_3"> $ close_div = true;} $ product [$ i] ['image'] resonate , If ($ i% 4 == 3) {echo ' gt; div class = "clear"> '; $ Close_div = false;} $ Prevprod = $ curprod;}    

Comments