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.
A special welcome to our newest member, KnoldTot.
What is the best location for common methods?
#1
19 Apr 2022, 7:32pm UTC
Tuesday 19th April 2022, at 7:32pm UTC
Status: Resolved
Edited on Tuesday 19th April 2022, at 7:32pm UTC
#2
19 Apr 2022, 8:57pm UTC
Tuesday 19th April 2022, at 8:57pm UTC
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
Edited on Tuesday 19th April 2022, at 9:01pm UTC
#3
19 Apr 2022, 9:03pm UTC
Tuesday 19th April 2022, at 9:03pm UTC
That will be perfect. Thank you!
Edited on Tuesday 19th April 2022, at 9:03pm UTC