Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes, that can be done.</p> <p>The way to do it is in pagination configuration array, 'uri_segment' should be variable:</p> <p>$config['uri_segment'] = $segment_offset;</p> <p>$segment_offset can be calculated by looking for '/pg/'(from your example) in the URI.</p> <p>Example code:</p> <pre><code> //for pagination $start = 0; $limit_per_page = 100; //URI to acoc array: $uri_array = $this-&gt;uri-&gt;uri_to_assoc(4); /* Array ( [page_links] =&gt; 0 ) */ //Take the number of pagination segment from uri; return URI number by its name $segment_offset = 0; foreach($uri_array as $key=&gt;$value){ $segment_offset++; if('page_links' == $key){ //segment founded break; } } //calculate actual place or pagination number //$segment_offset = $segment_offset + uri_to_assoc(**4**) + **1** place after the segmwnt 'page_links' is actual number for pagination; $segment_offset = $segment_offset + 4 + 1; //DB query can be here // /////////////////////////////////////////////////////////////////////// // NOTE: Set up the paging links. Just remove this if you don't need it, // NOTE: ...but you must remember to change the views too. // /////////////////////////////////////////////////////////////////////// $this-&gt;load-&gt;library('pagination'); $this-&gt;load-&gt;helper('url'); $config['base_url'] = site_url('controller1/browse/pg/'.$pg.'/other_segment/etc..'); $config['total_rows'] = xxx; $config['per_page'] = $limit_per_page; //$config['uri_segment'] = xx; //now that can be variable, and not just on the end of the URI $config['uri_segment'] = $segment_offset; $config['first_url'] = '0'; $config['num_links'] = 4; $this-&gt;pagination-&gt;initialize($config); $the_results['page_links'] = $this-&gt;pagination-&gt;create_links(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload