CodeIgniter Forums

Full Version: loop div in codeignighter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how to get div in a loop..

i want first row 3 items and it comes to down then 3 items and same....like grid wise..please help 


foreach ($list as $key => $value) {
 if($l==3){
break;
}


for($j=0;$j<=$l;$j++)
{


?>



<div class="col-md-3" style="text-align:center">
contents........
</div>


<?php

}
}?>
PHP Code:
<?php
$l 
0;
foreach (
$list as $key => $value)
{
 
   if ($l == 3)
 
   {
     
$l 0;
 
   }
?>
    <div class="col-md-3" style="text-align:center">
        contents........
    </div>
<?php
    $l
++;
}
?>

Something like that, not tested.
if $list from database, why not just limit your query?