Welcome Guest, Not a member yet? Register   Sign In
loop div in codeignighter
#1

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

}
}?>
Reply
#2

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

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




Theme © iAndrew 2016 - Forum software by © MyBB