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

(This post was last modified: 06-08-2022, 01:36 PM by venance.)

Thank you @webdeveloper very much! It's working as expected, But I have a question about setting up the counter to begin with 1 instead of  0,
PHP Code:
<?php 
      $link 
$pager->links();
?>
<?php 
for($i 1$i count($pager->links()); $i++): ?>
<?php 
if($i >= ): ?>
        <li> <?=  $link[$i]['title'?></li>
<?php endif; ?>
<?php 
endfor; ?>
The purpose of doing this is to be able to create ci4 pagination with the look like this: Prev 1 2 3 4 5 . . . 10 20 Next. So I can be able to generate some logic's to meet this features.
I would like to hear any advice or alternatives of doing the same with ci4 pager.
Reply


Messages In This Thread
RE: How to loop pagination links using for loop instead of using foreach loop - by venance - 06-08-2022, 01:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB