CodeIgniter Forums
pagination links - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: pagination links (/showthread.php?tid=15809)



pagination links - El Forum - 02-15-2009

[eluser]insub2[/eluser]
From the CI library:
Code:
// Write the digit links

for ($loop = $start -1; $loop <= $end; $loop++)

{

    $i = ($loop * $this->per_page) - $this->per_page;

            

    if ($i >= 0)

    {

        if ($this->cur_page == $loop)

        {

            $output .= $this->cur_tag_open.$loop.$this->cur_tag_close; // Current page

        }

        else

        {

            $n = ($i == 0) ? '' : $i;

            $output .= $this->num_tag_open.'<a >base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close;

        }

    }

}

What is the point of having the number displayed and the page number that is actually linked to be different?


pagination links - El Forum - 02-16-2009

[eluser]TheFuzzy0ne[/eluser]
I asked myself the same question. I came to the conclusion that it gives you more flexibility, so you don't have to make your model aware of how to paginate. Instead, it would only need to be fed the starting result, and the offset, not a page number.