boionfire81 Posted May 21, 2016 Share Posted May 21, 2016 Why is McCodes hated so much online? Outside of this forum finding help is almost useless. 80% of coders wont touch an mccodes script. The others want to charge $100 just to install a mod that was bought from mccodes. I guess you could say the good news is I'm learning more and more about php/mccodes? Anyways anyone help me with how do I recreate the woocommerce look for my mccodes shop pages? Meaning how they have 4 cells across and then go to the next line, 4 cells, next line etc...? Closest I have here is the never ending loops -.- Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 21, 2016 Share Posted May 21, 2016 (edited) I take it that in your page you have some sort of loop right? Whether it be a while or a for* loop, it's pretty much the same principle. $i = 0; // start the increment while($r = $db->fetch_row($query)) { print "<div class='container'>"; print "all your items in this container"; print "</div>"; if($i == 3) //3 because we started with 0. 0,1,2,3 = 4 { print "<div class='row'></div>"; // This will be some sort of "line break" } $i++; } Something like that. You will have to make it work with your own stuff. Everything is just an example. I used entities because the bbcode parser strips out HTML Edited May 21, 2016 by KyleMassacre Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted May 21, 2016 Author Share Posted May 21, 2016 ok so $i = 0; // start the increment while($r = $db->fetch_row($query)) { print "<div class='container'>"; print "all your items in this container"; print "</div>"; if($i == 3) //3 because we started with 0. 0,1,2,3 = 4 { print "<div class='row'></div>"; // This will be some sort of "line break" } $i++; } just put my html for a tr row in the container, and it will print 4 td and break to a new line and repeat on it's own? That's cool. Mind defining the $i = 0 portions so if I ever need to do this type of thing again I'll know. Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted May 22, 2016 Author Share Posted May 22, 2016 That just gave me 5 items side by side?? How do I break into a new row? Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 22, 2016 Share Posted May 22, 2016 My HTML was just an example but you can try changing the div class row to a br tag Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 22, 2016 Share Posted May 22, 2016 The $i = 0 is just that. You are asigning the i to 0 and the $i++ increments the i + 1. It's similar to $i = $i + 1 Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted May 22, 2016 Author Share Posted May 22, 2016 ok, so the first $i should be $i = 4? Then just add $i++ at the end? I mean just curious does it need to be kept repeating until when? I have no idea how many items will end up being there so??? Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 22, 2016 Share Posted May 22, 2016 (edited) No the first $i needs to be 0 and then you keep repeating. But I did notice I made a booboo. $i = 0; // start the increment while($r = $db->fetch_row($query)) { print "<div class='container'>"; print "all your items in this container"; print "</div>"; /* * 3 because we started with 0. 0,1,2,3 = 4 * This will check to see if $i is a multiple of 3 */ if($i%3 == 0) { print "<div class='row'></div>"; // This will be some sort of "line break" } $i++; } Edited May 22, 2016 by KyleMassacre Dont understand this bbcode crap Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted May 22, 2016 Author Share Posted May 22, 2016 going to keep working on this. which is fun because I really don't understand what does what, how and why. But now the first row is a single then it's groups of 3?? Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 22, 2016 Share Posted May 22, 2016 Just so you know, my HTML is not real Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 22, 2016 Share Posted May 22, 2016 Also I see where it could be causing that to happen. You can try instead: if($i != 0 && $i % 3 == 0) Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 22, 2016 Share Posted May 22, 2016 $i % 3 is in laments terms to make it simple $i/3. Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted May 22, 2016 Author Share Posted May 22, 2016 (edited) Ok, first row is 4, but then the next are only 3's here's what I have $i = 0; // start the increment while($r = $db->fetch_row($qtwo)) { print "<td><table class='shopitem'><tr><th>{$r['itmname']}</th></tr><td height='75px'><div id='box' style=background-image:url('css/images/shops/itmpic/" . $r['itmpic'] . "');><div id='overlay'><span id='plus'><a href='iteminfo.php?ID={$r['sitemID']}'><br><img src='css/images/shops/info.png'><br><br></a></span></div></div></td></tr><tr><td><center><b>" . money_formatter($r['itmbuyprice']) . " </b></center></td></tr><tr><td><center><form action='itembuy.php?ID={$r['sitemID']}' method='post'>Qty: <input type='number' name='qty' min='1' max='100' value='1' maxlength='3' /><br><input type='submit' value='Buy' class='storebutton'/></form></center></td></tr></table></td>"; if($i != 0 && $i % 3 == 0) //3 because we started with 0. 0,1,2,3 = 4 { print "</tr><tr>"; // This will be some sort of "line break" } $i++; } echo "</tr></table>"; } Edited May 22, 2016 by boionfire81 Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 22, 2016 Share Posted May 22, 2016 See what happens when you change the 3 to 4. I may have gotten confused Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted May 22, 2016 Share Posted May 22, 2016 Also, your table should be out of the loop. You should only be printing your table rows inside the loop Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted May 22, 2016 Author Share Posted May 22, 2016 I changed the three to a four which gave me 5 on top and 4 on the other rows. And, the tables are inside a table. Need to for the overlays. Quote Link to comment Share on other sites More sharing options...
sniko Posted May 24, 2016 Share Posted May 24, 2016 Why is McCodes hated so much online? Outside of this forum finding help is almost useless. 80% of coders wont touch an mccodes script. The others want to charge $100 just to install a mod that was bought from mccodes. I guess you could say the good news is I'm learning more and more about php/mccodes? Anyways anyone help me with how do I recreate the woocommerce look for my mccodes shop pages? Meaning how they have 4 cells across and then go to the next line, 4 cells, next line etc...? Closest I have here is the never ending loops -.- Because your budget implied you were prepared to pay such amount You're paying for someone to work on deprecated code (namely the mysql_* extension and others (purposely being vague, it's been a while since I've touched mccodes)) You're paying someone to work with sub-par procedural code You're paying for the persons time Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted May 24, 2016 Author Share Posted May 24, 2016 One guy contacted me from here, saying he would handle the work. After almost a week of hiring him through freelancer and creating the milestone deposit nothing has been done. This is ludacris. Quote Link to comment Share on other sites More sharing options...
SRB Posted June 3, 2016 Share Posted June 3, 2016 (edited) Throw them into div's, float left, set to 25% width and voila - 4 to a line. Throw in padding: 10px with a box-sizing:border-box and you're having some smexii times. Edit Simply using code similar to this; http://codepad.org/K7ojmZEX You get a layout like; https://jsfiddle.net/mzym6Lc5/ Edited June 4, 2016 by Guest Quote Link to comment 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.