• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pagination does not behave as I expect

#1
[eluser]Unknown[/eluser]
I am trying out CodeIgniter and my first experiment is just a Guestbook, but the Pagination Library does some strange things. My code is this:

Code:
function page($number=1)
    {
        $this->load->helper(array('form','url'));
        $this->load->model('guestbookentries','entries');
        
        $this->load->library('pagination');
        $config['base_url'] = site_url("guestbook/page");
        $config['total_rows'] = $this->entries->count();
        $per_page = 3;
        $config['per_page'] = $per_page;
        $this->pagination->initialize($config);
        
        $data['title'] = "G√§stebuch";
        $data['entries'] = $this->entries->get_some_after($per_page,$number);
        $data['pagination'] = $this->pagination->create_links();
        
        $this->load->view('guestbook', $data);
    }
get_some_after is SELECT LIMIT OFFSET.
I would have expected, that I should have written
Code:
$data['entries'] = $this->entries->get_some_after($per_page,$per_page*$number-$per_page);
but I get links in my Pagination like .../page, .../page/3, .../page/6 etc.
I'd rather have /1, /2, /3 etc.

Is there something wrong with my code, or is this the way it is meant to be?


Messages In This Thread
Pagination does not behave as I expect - by El Forum - 07-15-2007, 03:07 PM
Pagination does not behave as I expect - by El Forum - 07-15-2007, 05:56 PM
Pagination does not behave as I expect - by El Forum - 07-18-2007, 06:33 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme ¬© 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.