Welcome Guest, Not a member yet? Register   Sign In
How to loop pagination links using for loop instead of using foreach loop
#1

Hello everyone, I'm trying to loop link in my pagination template view, I want to be able to check various condition with the counter,
for example:
PHP Code:
<?php for($i 1$i <= count($pager->links()); $i++): ?>
       <li style="padding:5px"><?= $pager->links()['title'][$i?></li>
<?php endfor; ?>
But I want to be able to uset array items within $pager->links(), uri, title est. Like when It used with foreach like this
PHP Code:
<?php foreach ($pager->links() as $link) : ?>
     <li <?= $link['active'] ? 'class="active"' '' ?>><a href="<?= $link['uri'?>" ?>"><?= $link['title'?></a></li>
<?php endforeach ?>
How this can be done with for loop?
Thank you in advance!
Reply


Messages In This Thread
How to loop pagination links using for loop instead of using foreach loop - by venance - 06-08-2022, 07:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB