• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom routing, if not controller, do following

#1
[eluser]msteudel[/eluser]
I was wondering if there is a way to do something with routing so that if the string where the controller is isn't a controller it does one thing and if it is a controller then it performs normally. I'm pursuing a regex route, but I didn't want to have to hard code all of my controllers in it ...

#2
[eluser]gyo[/eluser]
There is a new route in CodeIgniter 2: $route['404_override'] = 'controller/method';

Where 'controller/method' is the one that will be called in case the requested controller doesn't exist.

Hope it helps!

#3
[eluser]msteudel[/eluser]
Interesting, I'm still on 1.7.2 but that's cool to know about. I ended up doing something like this:

$route['^(?!discover|blog|support|photos).*'] = "photos/show/$0";


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.