Welcome Guest, Not a member yet? Register   Sign In
Adding dynamic route at run time
#1

[eluser]Unknown[/eluser]
I am implementing URl rewriting via CI's routing feature. By default it allows to mention rules in routes.php.

Now I want to make it a generic function. The function will take url(non-SEO) url as input and pattern needs to be mapped for SEO(routed) URL and it returns the URL matches the pattern. For instance

Code:
function generte_seo_url($non_seo_url,$pattern)
  {
    return $seo_url;
  }

the issue is that I don't know when $route gets values and where do I add this method because route array always returns null if I echo it in any controller. Any help will be appreciated
#2

[eluser]Phil Sturgeon[/eluser]
For this one you will need to modify the Router controller by making an extention class or replacing it entirely.

I can remember the code exactly, but around line 120ish there is a line:

Code:
@include_once(APPDIR.'config/routes.php')

That's where you'll have access to the routes array and be able to write your own values into it.




Theme © iAndrew 2016 - Forum software by © MyBB