Remove controller name for affiliate system |
[eluser]Mantero[/eluser]
I'm currently adding affiliate system to my site. currently my affiliate agent can use URL like this: http://www.mysite.com/affiliate/mantero 'mantero' is affiliate id which is unique and dynamic my problem is how I'm able to remove the controller name in URL and they can just use like this: http://www.mysite.com/mantero My appologies if this has been asked before..but I really could'nt find any solution for my exact problem thanks in advanced
[eluser]Mantero[/eluser]
just to add I also have another controller..so is it possible to use routes? how if so.. thanks
[eluser]Rok Biderman[/eluser]
If you add this into config/routes.php it should do the trick: Quote:$route['mantero'] = 'affiliate/mantero';
[eluser]Mantero[/eluser]
[quote author="Coccodrillo" date="1297709044"]If you add this into config/routes.php it should do the trick: Quote:$route['mantero'] = 'affiliate/mantero';[/quote] how I'm supposed to do that..that 'mantero' is the ID which is unique and dynamic..it just an example... if I have thousands of ID I don't think I can make a routes for all that...
[eluser]Rok Biderman[/eluser]
in that case: Code: $route[‘(:any)’] = ‘affiliate/$1’;
[eluser]cideveloper[/eluser]
[quote author="Coccodrillo" date="1297714846"]in that case: Code: $route[‘(:any)’] = ‘affiliate/$1’; That will not work since he has other controllers. Thus his other controllers will be routed to "affiliate/controller_name". I dont really have a solution but I just know this did not work for me. If I am wrong please let me know so I can fix my code. Maybe hooks are a better solution?
[eluser]Mantero[/eluser]
[quote author="cideveloper" date="1297716662"][quote author="Coccodrillo" date="1297714846"]in that case: Code: $route[‘(:any)’] = ‘affiliate/$1’; That will not work since he has other controllers. Thus his other controllers will be routed to "affiliate/controller_name". I dont really have a solution but I just know this did not work for me. If I am wrong please let me know so I can fix my code. Maybe hooks are a better solution?[/quote] yes, the problem is because I have other controller as well.. can we make exception for the routes? I mean if I have Controller1,Controller2,Controller3, except all these controller will goes to affiliate controller...are this possible?
[eluser]Mantero[/eluser]
I mean like this Code: $route['^(?!controller1|controller2|controller3).*'] = "affiliate/$0";
[eluser]Rok Biderman[/eluser]
Why wouldn't this work? Code: $route['otherroute/(:any)'] = "othercontroller/$1";
[eluser]Mantero[/eluser]
[quote author="Coccodrillo" date="1297718408"]Why wouldn't this work? Code: $route['otherroute/(:any)'] = "othercontroller/$1"; $route['otherroute/(:any)'] = "othercontroller/$1";<--that mean I have to define the route for each of my controller? |
Welcome Guest, Not a member yet? Register Sign In |