Where do I put constants file for Codeigniter (PHP)?
Posted
by wag2639
on Stack Overflow
See other posts from Stack Overflow
or by wag2639
Published on 2010-06-14T21:24:46Z
Indexed on
2010/06/16
5:22 UTC
Read the original article
Hit count: 184
I have a list of constants (I'm using them as an enum), some are define statements, and some are just global variables.
Where am I suppose to put them in the MVC framework so I can use them for both my model and my controller that needs to reference it?
I'd rather not stick it into config/constants.php since they shouldn't be called except for by this model and the controllers that use it.
Edit 1: Clarification
To be more specific, I have my message_model
model and it has a bunch of constants that I need that are stored in message_model_constants.php
. Where should I put message_model_constants.php
and is there a way to have it automatically included by the controller that loads message_model
when message_model
is not (and I don't want it to be) auto-loaded.
Edit 2:
I really don't want to have the constants auto-loaded except for when I use the model
© Stack Overflow or respective owner