Welcome Guest, Not a member yet? Register   Sign In
Can i use application/config/constants.php?
#1

[eluser]Unknown[/eluser]
Been trying to look for documentation for this but couldn't find any. Anyway, what is the config/constants.php file for? Can I use it to store my constants?

Normally, I store constants in config.php and call it with $this->config->item(). However, I have a certain project where it won't be feasible to do so.

I was wondering if I could use constants.php for this and if there would be any adverse effects.

Thanks.
#2

[eluser]joneslee[/eluser]
I don't think there would be any negative effects. I normally put global constant into config.php.
#3

[eluser]Ch!ps[/eluser]
As answered by Pascal Kriete (from ElisLab), constants should go to the constants.php file.
http://ellislab.com/forums/viewthread/101928/#514265
#4

[eluser]xwero[/eluser]
If you are shy to add content to the constants.php file you can use the pre_system hook to load your own constants file. This hook is executed after the loading of the constants.php files so don't add constants with the same name.
#5

[eluser]Colin Williams[/eluser]
No reason not to edit it. Anything in your application folder should be thought of as editable. Otherwise it would be in the system folder.
#6

[eluser]darkhouse[/eluser]
I think maybe people think it shouldn't be touched because it's in the 'config' folder.
#7

[eluser]Colin Williams[/eluser]
Well, I hope they are editing the config.php and database.php files, among others!
#8

[eluser]xwero[/eluser]
People, newcomers especially, tend to be shy about editing files that are shipped with the framework. Take the language files for instance. Rather than editing the language files in the system/languages directory people copy the files to application/languages and edit them there.

Everything is editable but you have to know what you are doing.




Theme © iAndrew 2016 - Forum software by © MyBB