10-13-2008, 03:15 AM
[eluser]gafro[/eluser]
Hey Guys and Gals,
Looking for some info with the results received from a query.
overview example:
DB (table name = items)
id name
1 titleone
2 titletwo
3 titlethree
4 titlefour
Controller
$this->db-get('items');
view
<ul>
<?php foreach($items-result() as $item):?>
<li><?=$item->titleon?></li>
<?php endforeach;?>
</ul>
What I'd like to do is add a class to the li on every 3rd row.
<ul>
<li>itemone</li>
<li>itemtwo</li>
<li class="classname">itemthree</li>
<li>itemfour</li>
</ul>
I'm not sure how to get access to the keys from the array the active record has returned.
Can anyone shed some light or point me in the right direction.
Cheers all
Gafroninja
Hey Guys and Gals,
Looking for some info with the results received from a query.
overview example:
DB (table name = items)
id name
1 titleone
2 titletwo
3 titlethree
4 titlefour
Controller
$this->db-get('items');
view
<ul>
<?php foreach($items-result() as $item):?>
<li><?=$item->titleon?></li>
<?php endforeach;?>
</ul>
What I'd like to do is add a class to the li on every 3rd row.
<ul>
<li>itemone</li>
<li>itemtwo</li>
<li class="classname">itemthree</li>
<li>itemfour</li>
</ul>
I'm not sure how to get access to the keys from the array the active record has returned.
Can anyone shed some light or point me in the right direction.
Cheers all
Gafroninja