In the documentation of FuelPHP, it has the following sample:
// or fetch the output of a module
$widget = Request::forge('mymodule/mycontroller/mymethod/parms', false)->execute();
echo $widget;
This works when the function I am calling has the action_
prefix, but when I remove the prefix (since I don't want it to be called by the browser) it doesn't work anymore even if I set the 2nd parameter to false
.
Here is an example:
WORKS
In one controller I call:
$widget = Request::forge('mymodule/mycontroller/mymethod')->execute();
echo $widget;
In mycontroller:
public function action_mymethod()
{
echo 'works';
}
FAILS with 404
In one controller I call:
$widget = Request::forge('mymodule/mycontroller/mymethod', false)->execute();
echo $widget;
In mycontroller:
public function mymethod()
{
echo 'works';
}