I'm using the same method in different controllers and I don't want to repeat myself.
Where would be the best place for custom methods that I can access in all my controllers without changing the code in the core?
For example, I added a logging function which inserts records into the comments table and want to use it in all my controllers.
What is the best location for common methods?
4 years ago
4 years ago
#1
4 years ago
#2
Hello,
I would create a module called Custom_Methods and put it all in there.
You call another module with the following code.
Calling another module from a controller:
https://trongate.io/docs_m/information/calling-another-module-from-a-controller
You call another module with the following code.
Calling another module from a view:
https://trongate.io/docs_m/information/calling-another-module-from-a-view
I would create a module called Custom_Methods and put it all in there.
You call another module with the following code.
Calling another module from a controller:
https://trongate.io/docs_m/information/calling-another-module-from-a-controller
You call another module with the following code.
Calling another module from a view:
https://trongate.io/docs_m/information/calling-another-module-from-a-view
4 years ago
#3
That will be perfect. Thank you!