Welcome Guest, Not a member yet? Register   Sign In
config items versus constants, seeking clarification.
#1

[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.
#2

[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.
#3

[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?
#4

[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.




Theme © iAndrew 2016 - Forum software by © MyBB