• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.