CodeIgniter Forums
loop div in codeignighter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: loop div in codeignighter (/showthread.php?tid=63932)



loop div in codeignighter - adithyakalmane - 12-24-2015

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

}
}?>


RE: loop div in codeignighter - InsiteFX - 12-24-2015

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.


RE: loop div in codeignighter - suhindra - 12-24-2015

if $list from database, why not just limit your query?