How Autoload function on base controller ? |
Re: helper function
in CI 4.0.4 what i'm currently doing in BaseController.php Code: <?php then in my controller Code: <?php namespace App\Controllers; because all my controllers "extend" BaseController they get functionality of helper. So for instance on view i want footer to display Copywrite from : to I pass date to view in controller's as: Code: 'date'=>$this->myDate does this give you any clue ? i'm sure somebody will tell me there's a more elegant way of doing it but main points of my point are: 1) if you declare helper in BaseController and then extend your Controller from BaseController that saves you to having to repeat helper code in every controller you use. I use a construct in BaseController so that when i use a controller that will be called. I don't call "$this->myDate" in each controller because its a member property of the BAseController but because my controllers extend BAseController they inherit or have access to attribute of BaseController. I probably need to review public, protected at some point but my approach is :get ot working" then refine later |
Messages In This Thread |
How Autoload function on base controller ? - by iblisious - 09-24-2020, 02:21 AM
RE: How Autoload function on base controller ? - by captain-sensible - 09-24-2020, 07:49 AM
RE: How Autoload function on base controller ? - by iblisious - 09-27-2020, 12:15 AM
RE: How Autoload function on base controller ? - by InsiteFX - 09-27-2020, 03:54 PM
RE: How Autoload function on base controller ? - by iblisious - 09-27-2020, 08:39 PM
RE: How Autoload function on base controller ? - by InsiteFX - 09-27-2020, 11:53 PM
|