by
0
5
1,435
3
Top 1% !
Famous
Tagged
Specified
OpenSource
Popularity: 19685th place
Architecturex86_64
Extensionnew 20
OSWindows
Windows VersionWindows8

codeigniter-pagination-url-with-get-parameters

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1362035/codeigniter-pagination-url-with-get-para?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
<? $this->load->library('pagination'); $item_per_page = 48; $total_rows = //query here for total num of items from model // thanks to Aurel for the trick see http://stackoverflow.com/questions/5384644/codeigniter-pagination-url-with-get-parameters if (count($_GET) > 0) $config['suffix'] = '?' . http_build_query($_GET, '', "&"); $config['base_url'] = base_url().'/controller/method/'; $config['first_url'] = $config['base_url'].'0?'.http_build_query($_GET); $config['per_page'] = $item_per_page; $config['total_rows'] = $total_rows; $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $offset = $this->uri->segment(3); if(!$offset) $offset = 0; $data['result'] = // query with offset and limit ($item_per_page) //call view $this->load->view("view",$data)
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus