Welcome Guest, Not a member yet? Register   Sign In
Helpers loading with each include statement
#4

(08-09-2021, 03:59 PM)SoccerGuy3 Wrote: It just dawned on me that those should be individual functions and each called where they are needed. My thought process was backwards on this. I was thinking I was calling this once and loading a "variable" with the information when in fact I am calling this function/helper every time I display one of the elements.
Doh!
Sorry for the silly question.

Then maybe a library would be better for this use case. You can load the info in a member variable of your class and if you call it again later, you can use the same instance of the library, so it doesn't need to get the data from the database. It would just return the data stored in memory. Of course this is only true if you need the same info in the same execution cycle.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply


Messages In This Thread
RE: Helpers loading with each include statement - by includebeer - 08-09-2021, 05:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB