I want to understand how Configure::write('Config.language','fre'), do I have to call this function in beforFilter() methode ? when i call it does it save the the configuration in session or it does not save at all ?
+4
A:
Configure::write() is really just for setting CakePHP configuration directives. You don't want to use it to write to the session (in fact, it just flat out doesn't do that). Chances are good that you're barking up the wrong tree if you're trying to use it. If it's saving state between requests that you want, check out the Session component at http://book.cakephp.org/view/173/Sessions
Travis Leleu
2010-01-04 23:56:28
A:
Configure::write() is for writing application wide constants. So if you want to set a limit on products or something like that you could set that globally using Configure::write().
Then you can use Configure::read() to read that value out again.
I mainly use it to store application settings :)
DavidYell
2010-01-05 11:33:50
Here you are talking about storing (saving) but it does not behave like that (i have to write the config at every request)
Ayoub
2010-01-06 09:37:01
Config::write() should be used in your app/config/core.php, if you are saving into the session in your controller $this->Session->write()
DavidYell
2010-01-07 09:14:07