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

(This post was last modified: 06-08-2022, 08:29 AM by webdeveloper.)

I really don't know why you need this, but did you try it like below? If it's associative array, it should work.

PHP Code:
<?php for($i = 0; $i < count($pager->links()); $i++): ?>
       <li <?= $pager->links()[$i]['active'] ? 'class="active"' : '' ?>><?= $pager->links()[$i]['title'?></li>
<?php endfor; ?>
Reply


Messages In This Thread
RE: How to loop pagination links using for loop instead of using foreach loop - by webdeveloper - 06-08-2022, 08:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB