In the controller folder of the module I have my widget.php controller, like this :
namespace Gmtest;
class Controller_Widget extends \Controller_Base_Public
{
public static function say($text)
{
return 'The text is : ' . $text;
}
}
If I am in a different controller, from the admin area let's say, and I want to call the static method from my module,(my widget class), it works only if I do it like this :
Module::load('gmtest');
echo \Gmtest\Controller_Widget::say('hello World!');
What should I do, in order to call it like this :
echo \Gmtest\Widget::say('hello World!');
??
Of course that a solution would be to make the namespace Gmtest\Controller and to rename the class from Controller_Widget to Widget...but is not what I want, as the doc gives us the example like this :
namespace Mymodule;
class Controller_Widget { #code }
A second question is also related to namespaces.
For a better understanding, if I am inside my module, and I call another class from the SAME module (of course with the same namespace), I don't have to use the '\', but if I call from my module a standard Fuel class, I have to use it, correct ?
Thanks for your answers.
It looks like you're new here. If you want to get involved, click one of these buttons!