<?php foreach($products as $product) : ?>
<li><a href="<?php echo base_url(); ?>main/products/<?php echo $product->id; ?>">
<?php echo $product->name; ?> </a></li>
<?php endforeach; ?>
So the code above get’s all records in a DB and generates links. 100 Records in the table – I want to split the design into 5 col. So I will do that in CSS but I need to be able to enclose
<ul> on every 20 records</ul>
How can i count the loop and do this?
Do like this , this will solve your problem
*edit- set $i = 0; since arrays count from [0] by setting it to [1] makes the first
colhave 19 instead of 20. By setting it to [0] Each col has 20. 🙂 Thanks again ~fabio