Reputation: 3731
I ve just installed last 1.7 version of Fuelphp and trying to play without routes, but got stuck a bit
What was done:
Created "special" action in "userspace" controller
public function action_special($a = 'empty')
{
var_dump($a);
die();
}
And routing for it
'test(/:any)?' => 'userspace/special/$1'
But the problem is if localhost/test returns
string(5) "empty"
so localhost/test/1 or localhost/test/qwerty returns
string(0) ""
but full path localhost/userspace/special/qwerty returns
string(6) "qwerty"
So somehow our "special" method cant get a parameter from routing.
Upvotes: 1
Views: 1255
Reputation: 1727
Because we're using regular expressions, routes are powerful but sometimes confusing. The regex should be something like:
'something(/(:any))?' => 'something/index/$2',
The (groups) are captured, but :any by itself is not captured, you'll need an extra (group) like the example above. And because it's the second group we'll put $2
in the route translation.
Upvotes: 2