Configure::write or define()

2008-09-26 Thread luigi7up
Hello everyone... I'm little confused with defining constants in Cake. I have a gallery of pictures that are on voting for _NUMBER_OF_HOURS constant. In my old application that was written in pure PHP and not Cake I had constants.php file where, all constants were defined like this:

Re: Configure::write or define()

2008-09-26 Thread Fran Iglesias
El 26/09/2008, a las 11:53, luigi7up escribió: As I understood old method define(); is much better because it uses php native way to define constants and latter on to use that constant you just call it like this: _CONSTANT_NAME. Configure is not intended for define constants. It's a

Re: Configure::write or define()

2008-09-26 Thread grigri
Benefits of using Configure: * No collisions with other php scripts. * Can be changed at runtime * Easy to organize, list, group and persist related settings Benefits of using php constants: * Less verbose * More efficient On Sep 26, 10:53 am, luigi7up [EMAIL PROTECTED] wrote: Hello

Re: Configure::write or define()

2008-09-26 Thread luigi7up
Thanks for your reply. In practical example where you want to define number of hours you want your gallery pictures to be on voting what would you use? By the way is it okay to use define(); in bootstrap? Thanks On Sep 26, 12:09 pm, grigri [EMAIL PROTECTED] wrote: Benefits of using

Re: Configure::write or define()

2008-09-26 Thread mark_story
For me the difference between Configure::write() and define() comes down to mutability. If you need to change a value at run time then use Configure::write(). If in fact your value is a constant and will never change during script execution, then use define. It is semantically more correct