Search code examples
codeigniteranchorredefinitionurlhelper

Codeigniter - Is it possible to redefine anchor function


I have human friendly urls without index.php. I had to modify .htaccess file for that. Actually I always use Codeigniter like this. My url-s always look like this:

www.example.com/controller/function/parameter

So if I have an extra url parameter, then the url looks like this:

www.example.com/controller/function/parameter?archive=2013

Now what I want to do: If there is 'archive' parameter in the url, than also add that to the url when anchor function creates a link.

We have some different stuff every year (like stylesheets), so I need to make this navigation automatic. Am I thinking in the right direction?


Solution

  • And the answer is "Yes".

    I slightly modified the solution from here:

    How to extend anchor() function to anchor_admin() in CodeIgniter?