Sunday, February 20, 2011

Re: configuration values in database?

I accomplished this using a model and the Configure class, like so:

Configure::write('Forum.settings',
ClassRegistry::init('Forum.Setting')->getSettings());

Place that in your bootstrap or AppController.

The technique is being used in my 2.0 forum plugin.

https://github.com/milesj/cake-forum/blob/2.0/forum_app_controller.php

On Feb 20, 10:31 am, kdubya <kenwin...@winanstech.com> wrote:
> My suggestion would be to create a Model (maybe called Configuration
> with a DB table called configurations) for your configuration data
> then add the Model to your app_controller ($uses =
> array('Configuration');) so that it is available in all controllers.
> Depending on what you want to do with he configuration data, you may
> not need a controller. The Model class Configuration should probably
> have methods like get() and put() for accessing and adding/changing
> your settings.
>
> To learn about adding an app_controller.php to your app, see:http://book.cakephp.org/#!/view/957/The-App-Controller
>
> HTH,
> Ken

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate