Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Global functions or hereditary functions.
apkahym
February 2018
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?
Harro
February 2018
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.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
February 2018