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, faster and less typing.

-Mark

On Sep 26, 9:05 am, luigi7up <[EMAIL PROTECTED]> wrote:
> 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 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 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:
> > > define('name', value);
>
> > > I tried this in my bootstrap.php and it works and I could go with this
> > > but in manual I see some methods like Configure::write and ::read to
> > > do this?!?!
>
> > > 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.
>
> > > With configure method writing and reading takes some some time and
> > > then again it is pain in the a** to do Configure::read() every time I
> > > need value of _CONSTANT_NAME.
>
> > > My question is the benefit of using Cake approach??? I can see some
> > > dynamic aspects but everything can be achieved with define();
>
> > > Am I wrong ??
>
> > > Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to