-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow loading Common.php function overrides #2101
Comments
How about shipping Codeigniter >= RC1 with a blank/empty Basically, if the function exists in I may be able to find time in my busy day to produce a PR for this too, since I'd love to contribute to the framework I've used for eons. For example here's a simple solution without a PR. Consider it a proof of concept: Replace: require_once SYSTEMPATH . 'Common.php'; With if ( file_exists(APPPATH . 'Common.php) ) {
require_once APPPATH . 'Common.php';
}
require_once SYSTEMPATH . 'Common.php'; This way, if Sorry if this is a bit of a ramble, it is late and I am tired ha-ha. If you'd like a PR, let me know =D |
I think that's the perfect way to handle it. It matches up with the blank BaseController we're shipping with to encourage it's use for adding common elements across all controllers, etc. If you've got time for a PR that would be awesome. Otherwise someone will get to it before RC1 ships (hopefully very soon). |
Okay cool beans. If I've time after picking up my car from the shop tomorrow after work, I will most certainly submit a PR. Maybe not with tests, but logic and docs would be my goal. Thanks Lonnie and my apologies if I do not get to this by tomorrow evening. |
I could also send this over. @jason-napolitano let me know if you aren't going to get to it. |
If you are faster than I am @MGatner then that'd be amazing. Just in case I don't get to it in a timely fashion =) |
Pull request submitted. Sorry there are no docs for you. I am not at all familiar with the documentation library to build them in a timely fashion. However the logic and EDIT: My apologies as well for the Travic-CI break. As long as I've been programming I've only issued one PR, and this is it and I am not too familiar with any continuous integration and the like (I posses an old-school, "save files my HDD as backups" mentality) =P. |
Originally discussed in this thread: https://forum.codeigniter.com/thread-74096.html
There is currently no elegant way for a developer to override any of the methods in Common.php. I think this can be remedied very simply:
system/bootstrap
check for the existence of a file,app/Config/Functions.php
(or maybeapp/Functions.php
) prior to loading the Common.php file.That's it. If a developer needs to override the function he can do it directly in that file or load other files that contain it, and not feel dirty editing
public/index.php
.The text was updated successfully, but these errors were encountered: