Skip to content
World Wide Web Server edited this page Jul 4, 2012 · 11 revisions

[h2]Introduction[/h2] Paging Simplified is an alternative paging class that is easier to use than CodeIgniter's default paging library.

[h2]Features & Limitations[/h2]

  • Extremely lightweight
  • Very easy to configure and use
  • GET query strings not supported
  • PHP5-only

[h2]Link format[/h2]

Links are in the format:

[code]

[/code]

The segment containing the current page number can vary (there can be additional segments before or after). Paging Simplified will automatically parse the segments and find the id that you pass to the [b]Paging::init()[/b] function.

Here's another example:

[code] http://mysite.com/controller/function/segment/[b]pg:5[/b]/segment/segment [/code]

[h2]Example Controller Code[/h2] [code] $this->load->plugin('paging');

$query = $this->db->get('items'); $item_count = $query->num_rows();

// total number of items, items per page, page segment id Page::init($item_count, 25, 'pg');

// generate the page links $this->data['paging'] = Page::page_links();

// get the items to show in the current page $this->data['items'] = $this->db->limit(Page::$perpage, Page::$offset)->get('items')->result();

// show the view $this->load->view('items_view', $this->data);

[/code]

[h2]Customizing the links[/h2]

Paging Simplified will automatically use the tag configuration in your pagination.php config file if it is present. For more information on the tag configuration options, see the [url=http://codeigniter.com/user_guide/libraries/pagination.html]CodeIgniter User Guide[/url].

Clone this wiki locally