Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If the only thing you want is to map your controller/method differently than the default behaviour, you can use the <code>route.php</code> config file. See the official documentation here : <a href="http://codeigniter.com/user_guide/general/routing.html" rel="nofollow">http://codeigniter.com/user_guide/general/routing.html</a></p> <p>In your case you'll have something like this :</p> <pre><code>$route['mali_oglasi/index/(:num)'] = 'mali_oglasi'; </code></pre> <p>Later in your controller you can still get the original digit by using :</p> <pre><code>$this-&gt;uri-&gt;rsegment(3); </code></pre> <p>instead of :</p> <pre><code>$this-&gt;uri-&gt;segment(3); </code></pre> <p>(see official documentation here : <a href="http://codeigniter.com/user_guide/libraries/uri.html" rel="nofollow">http://codeigniter.com/user_guide/libraries/uri.html</a> )</p> <p><strong>EDIT:</strong></p> <p>In fact, if you just wish to get rid of the "index" segment when you need to add parameter, you may want to do the inverse of my first answer :</p> <pre><code>$route['mali_oglasi/(:num)'] = 'mali_oglasi/index/$1'; </code></pre> <p>With that line, every request in the form of "www.yourdomain.com/mali_oglasi/1" will be interpreted by codeigniter as if it were "www.yourdomain.com/mali_oglasi/index/1". Meaning the method "index" of the controller "mali_oglasi" will be used to handle your request.</p> <p>If you need to retrieve the digit, you want to use :</p> <pre><code>$this-&gt;uri-&gt;segment(3); </code></pre> <p>So if your client should ever go to the url "www.yourdomain.com/mali_oglasi/index/1" directly, you will still retrieve the good uri segment. ( <code>$this-&gt;uri-&gt;segment(n);</code> give you the n-th segment after <code>route.php</code> rewrite the uri, and <code>$this-&gt;uri-&gt;rsegment(n)</code> give you the n'th segment before the uri is rewritten. )</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.
 

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