CodeIgniter Forums

Full Version: config items versus constants, seeking clarification.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]nuwanda[/eluser]
I'm wondering how others are using config items versus constants.

I understand that configs can be altered dynamically. This essentially means the config set in the config file is a default value and can then be altered temporarily for the duration of the script.

Makes sense.

Are there any other reasons to use config items over constants?

I tend to use constants as they are retrieved with less typing and they stand out more.

El Forum

[eluser]skunkbad[/eluser]
I define constants in hooks so that I can use them before config items are set. I use config items when they are specifically related to some library or code, to help keep things organized.

El Forum

[eluser]nuwanda[/eluser]
[quote author="skunkbad" date="1291117792"]I define constants in hooks so that I can use them before config items are set. I use config items when they are specifically related to some library or code, to help keep things organized.[/quote]

Just out of interest, what exactly are you using your hooks for?

El Forum

[eluser]skunkbad[/eluser]
[quote author="nuwanda" date="1291120844"][quote author="skunkbad" date="1291117792"]I define constants in hooks so that I can use them before config items are set. I use config items when they are specifically related to some library or code, to help keep things organized.[/quote]

Just out of interest, what exactly are you using your hooks for?[/quote]

I have a hook that sets up $_SESSION, and another for a custom error handler. I also have one that sets the X-Powered-By header.