Re: Where to define constants
I recommend using some other file and then loading that file in the bootstrap. This way if you need to update cake files you don't have to worry about overriding your stuff, well, only one line will be lost. I use a appconfig.php file with my stuff and then I load it in the bootstrap like this Configure::load('appconfig'); On Feb 2, 12:23 pm, Turgs wrote: > Thanks Brian!! > I knew they would be a logical place somewhere. > Cheers > Turgs > > On Feb 2, 4:38 am, brian wrote: > > > Place them in config/bootstrap.php. > > > But, if you're doing language-specific stuff, you'd be *far* off > > creating .po files and putting them in the locale dir. > > > On Sun, Feb 1, 2009 at 8:09 AM, Turgs wrote: > > > > Hi everyone. > > > > If I want to use constants within my model code and have those the > > > constants defined within a separate file (i.e. / > > > english_constants.php), where can I call require_once('constants.php) > > > so that my "whole" application (models, views and controllers) can see > > > those constants? > > > > If I put it in the AppController::beforeFilter(), the constants don't > > > seem to be available within the model. > > > > Thanks > > > Turgs --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Where to define constants
Thanks Brian!! I knew they would be a logical place somewhere. Cheers Turgs On Feb 2, 4:38 am, brian wrote: > Place them in config/bootstrap.php. > > But, if you're doing language-specific stuff, you'd be *far* off > creating .po files and putting them in the locale dir. > > On Sun, Feb 1, 2009 at 8:09 AM, Turgs wrote: > > > Hi everyone. > > > If I want to use constants within my model code and have those the > > constants defined within a separate file (i.e. / > > english_constants.php), where can I call require_once('constants.php) > > so that my "whole" application (models, views and controllers) can see > > those constants? > > > If I put it in the AppController::beforeFilter(), the constants don't > > seem to be available within the model. > > > Thanks > > Turgs > > --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Where to define constants
Place them in config/bootstrap.php. But, if you're doing language-specific stuff, you'd be *far* off creating .po files and putting them in the locale dir. On Sun, Feb 1, 2009 at 8:09 AM, Turgs wrote: > > Hi everyone. > > If I want to use constants within my model code and have those the > constants defined within a separate file (i.e. / > english_constants.php), where can I call require_once('constants.php) > so that my "whole" application (models, views and controllers) can see > those constants? > > If I put it in the AppController::beforeFilter(), the constants don't > seem to be available within the model. > > Thanks > Turgs > > > > --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Where to define constants
Hi everyone. If I want to use constants within my model code and have those the constants defined within a separate file (i.e. / english_constants.php), where can I call require_once('constants.php) so that my "whole" application (models, views and controllers) can see those constants? If I put it in the AppController::beforeFilter(), the constants don't seem to be available within the model. Thanks Turgs --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---