Prepend FUEL routes with prefix

edited April 2012 in Feature Requests
Hello there,
I'm trying to figure out how to allow FUEL routes to start with language codes, ie:

/en/fuel/dashboard --> /fuel/dashboard

so basically if the uri starts with /en or /de for example, i want it to be rerouted to the normal /fuel routes. I've tried

$route['^(en|de)/fuel/(.+)$'] = "fuel/$1";
and the rerouting kinda works, because I get sent to

/en/fuel/login/5a5734765a6e566c6243396b59584e6f596d3968636d513d
but the page throws an error:

A PHP Error was encountered
Severity: Notice

Message: Undefined offset: 1

Filename: hooks/Fuel_hooks.php

Line Number: 48

A PHP Error was encountered
Severity: Warning

Message: require_once(/Applications/MAMP/htdocs/siegelwerk/fuel/application/../modules/fuel//controllers/.php) [function.require-once]: failed to open stream: No such file or directory

Filename: hooks/Fuel_hooks.php

Line Number: 48
etc.
I kinda have the feeling i'm doing something wrong with the $1 in the route... but i dont get why!! can u help?

Comments

  • edited April 2012
    Use $2 instead of $1 because there are 2 sets of parenthesis. That error message is a bug (that will be fixed in next release). The fix is:
    if (!empty($fuel_path[1])) { require_once(FUEL_PATH.'/controllers/'.$fuel_path[1].'.php'); $class = $fuel_path[1]; }
Sign In or Register to comment.