Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Jason, you are making the problem yourself simply because you loose track of what segements are part of the controller/method, and which are your segments that you find relevant.</p> <p>I would first of all tell you to stick to one method say to append it to the end (this is from the users perspective in the uri, not your route config):</p> <pre><code>/view/page/1233/name/blue-skies/pg/20 </code></pre> <p>The above format would mean something like this on the backend: <code>/view/</code> is the controller, <code>page</code> is your method in the controller, then you would use <code>$this-&gt;uri-&gt;uri_to_assoc(4)</code> (4th element, being name to start).</p> <p>That way you correctly capture your page number <code>1233</code> and then all relevant data to it.</p> <p>As a suggestion, I would caution against using unreadable variables, it leads to confusion and does NOT make your site url SEO friendly (who knows what /v/p/123/v/l/20 means in the end?).</p> <p>Always user your <code>$this-&gt;output-&gt;profiler(TRUE);</code>, if you are having trouble with uri routing. Don't mess with your route config unless you REALLY need to, this may lead to confusion, which complicates your testing.</p> <p><strong>EDIT</strong> </p> <p>I created confusion because based on your question you could interpret it as a routing issue from the position of the config.php file OR the pagination class. I took it from the first approach.</p> <p>To clarify you need to simply stick to a clean url method, if you use uri_to_assoc, thats fine. But just don't loose track of your page number for the pagination.</p> <p>You can solve this by making the page number the last element in your uri</p> <p><strong>Last:</strong> <code>/view/page/1233/name/blue-skies/user/12/20</code></p> <p>Where the <code>20</code> is the page number that is generated by pagination, the other are segments you use for whatever.</p> <p>You would set your <code>$config['uri_segment'] = 6;</code> in this case, and your <code>$config['base_url'] = '/view/page/1233/'.$this-&gt;uri-&gt;assoc_to_uri($uri_segments);</code></p> <p>Where:</p> <pre><code>$uri_segments = array( 'name' =&gt; 'blue-skies', 'user' =&gt; '12'); </code></pre> <p><strong>IF</strong></p> <p>It is unknown how many segments you have (say a dynamic $uri_segments array), use <code>$this-&gt;uri-&gt;total_segments()</code> to count total segments, then your pagination one is the +1 to that (last).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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