Helpers loading with each include statement |
I have helpers that are loading site wide (menu stuff, message notifications, etc). I just noticed in the debugger that the helpers appear to be firing off on the initial page/view load and with each "include" within that view. Some helpers are database calls. This is causing the database to be hit 5-6 times PER PAGE for the exact same information. Is there a way to not have CI 4 repeatedly load a helper? The helpers are being loaded in the BaseController as they are needed on pretty much all pages (seemed a better solution that trying to remember to include in each individual controller):
Code: protected $helpers = ["form", "auth", "phone", "text","siteinfo","state","number","money"]; For example this code: PHP Code: <?= $this->include('_partials/topbar') ?> Code: SELECT COUNT(*) AS `numrows` FROM `lead_main` WHERE `status` != "Cancelled" |
Messages In This Thread |
Helpers loading with each include statement - by SoccerGuy3 - 08-09-2021, 02:05 PM
RE: Helpers loading with each include statement - by includebeer - 08-09-2021, 03:55 PM
RE: Helpers loading with each include statement - by SoccerGuy3 - 08-09-2021, 03:59 PM
RE: Helpers loading with each include statement - by includebeer - 08-09-2021, 05:03 PM
RE: Helpers loading with each include statement - by donpwinston - 08-10-2021, 03:14 AM
RE: Helpers loading with each include statement - by includebeer - 08-10-2021, 04:16 AM
RE: Helpers loading with each include statement - by SoccerGuy3 - 08-10-2021, 08:06 AM
RE: Helpers loading with each include statement - by SoccerGuy3 - 08-10-2021, 09:08 AM
|