Welcome Guest, Not a member yet? Register   Sign In
Pagination - Goto Last page [fixed]
#2

[eluser]happs74[/eluser]
Managed to fix it, problem was down to my lack of PHP knowledge again, who'd have thunk that strings evaluate to 0. Anyhoo if anyone else runs into the same problem I fixed it by making a quick change to the Pagination class, it looks kinda ugly this early in the morning but it'll do the trick before I come up with something cleaner.

I replaced the if block in create_links that just below the comment #Determine the current page number to

Code:
if( (string)$CI->uri->segment($this->uri_segment) != '0')
{
  if( (string)$CI->uri->segment($this->uri_segment) == 'last')
  {
    $this->cur_page = $this->cur_page = ((ceil($this->total_rows/ $this->per_page))-1) * $this->per_page;
  }
  else
  {
    if( ! is_numeric($this->cur_page))
    {
      $this->cur_page = 0;
    }
    else
    {
      $this->cur_page = $CI->uri->segment($this->uri_segment);
    }
  }
}

Edited cos I screwed up the cur_page calculation, it's a bit ugly and I need to do the same thing in my controller so I can pass it to model to select the correct block with limit.


Messages In This Thread
Pagination - Goto Last page [fixed] - by El Forum - 03-07-2008, 06:16 PM
Pagination - Goto Last page [fixed] - by El Forum - 03-08-2008, 02:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB