Hello,
A For Loop loops through an array until the end of the results.
Is it possible to add something every 4 entries?
I am thinking about adding a “back to top of page” link every 4 entries. Is this possible?
Thanks.
Hello,
A For Loop loops through an array until the end of the results.
Is it possible to add something every 4 entries?
I am thinking about adding a “back to top of page” link every 4 entries. Is this possible?
Thanks.
$count = 0;
foreach($items as $item) {
$count++;
if ($count === 4) {
$count = 0;
// Output your back to top link
}
}
Try This:
foreach($items as $id=> item) {
if ($id > 0 &&(! $id % 3))
{
echo $id.'<br>';
// Output your back to top link
}
}
Beware
Not tested, use at your own risk
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.