defining constants in a config file? |
(12-15-2015, 10:22 AM)sneakyimp Wrote:Martin7483 Wrote:If you are worried about misspelling and bugs, maybe you could do a combination. Use constants for the names of your config items instead of the values.I had considered this but ruled it out. It just seems ridiculous and doesn't solve the problem of name collisions because constants are global AFAIK. I had considered one other approach: attaching all my constants to some class: How does using a constant prevent name collisions? If you are worried about that you should really read the docs on the usage of config files. When loading a config you can pass in a second argument that helps avoid name collisions Quote:If you need to load multiple config files normally they will be merged into one master config array. Name collisions can occur, however, if you have identically named array indexes in different config files. To avoid collisions you can set the second parameter to TRUE and each config file will be stored in an array index corresponding to the name of the config file. https://codeigniter.com/user_guide/libra...onfig-file |
Messages In This Thread |
defining constants in a config file? - by sneakyimp - 12-14-2015, 03:48 PM
RE: defining constants in a config file? - by ivantcholakov - 12-14-2015, 06:07 PM
RE: defining constants in a config file? - by sneakyimp - 12-14-2015, 06:44 PM
RE: defining constants in a config file? - by ivantcholakov - 12-14-2015, 11:13 PM
RE: defining constants in a config file? - by sneakyimp - 12-15-2015, 10:22 AM
RE: defining constants in a config file? - by Martin7483 - 12-15-2015, 02:00 AM
RE: defining constants in a config file? - by InsiteFX - 12-15-2015, 04:25 AM
RE: defining constants in a config file? - by InsiteFX - 12-15-2015, 12:33 PM
RE: defining constants in a config file? - by Martin7483 - 12-16-2015, 03:09 AM
|