Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Global functions or hereditary functions.
  • Hi everyone,

    I need define a group of function to be called from any place of my app.
    I want define they in the class parent of all classes.

    For example, my parent class is Controller_Base
    and the function that i need to be called calculate();

    And i need can call it from template.php for example....

    How can i do it this function?
  • HarroHarro
    Accepted Answer
    If you want to use a standard function, you can define it in your app's' bootstrap.php, or in a file or files you include in your bootstrap.

    If you want to use a class method to be used in multiple classes, use a trait. They can be defined and loaded as any other class in Fuel.

Howdy, Stranger!

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

In this Discussion