Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
"Helper" functions for use in apps
  • Another "I did this in CodeIgniter" question: If I've got a function that I want to use all over my app, what's he best way to go about doing that? It really is only a couple of functions, so it isn't sophisticated like a package.
  • Put it in an application class (in app/classes), and define it as a static method. Then use Classname::helper() in your code to call the helper...
  • Hi all, although it is old post but if i call my test function from Helper class <?php Helper::test();?> in view,  thne get error
    ErrorException [ Fatal Error ]:
    Class 'Helper' not found

    plz can me somebody Help?
  • In the app/bootstrap.php file I always include my common helper functions...

    After:

    // Initialize the framework with the config file.
    Fuel::init('config.php');

    // Load Base Helper Functions File
    require APPPATH.'myfunctions.php';

  • Hi itcan, thank you very much!!!!! it works :)
  • No problem!
  • A static class method, like Helper::test(), should always work, as long as the class is defined in the correct file. In this case, APPPATH.'classes/helper.php'.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion