Re: Site wide settings with Configure::write and read
No more luck with :
function fetchSettings(){
$this->loadModel('Setting');
$this->set('settings', $this->Setting->find('all'));
$settingName = $setting['Setting']['name'];
$settingValue = $setting['Setting']['value'];
foreach($settings as $setting):
Configure::write($settingName, $settingValue);
endforeach;
}
Any idea ?
Le mercredi 11 avril 2012 13:33:07 UTC+2, JonStark a écrit :
Hello.I'm currently trying to achieve editable site-wide setting for my website with Configure::write and read.My db had id, name and value (ex: 1, site.name, My site)I have this function in AppController :function fetchSettings(){//Loading model on the fly$this->loadModel('Setting');//Fetching All params$this->set('settings', $this->Setting->find('all'));$name = $setting['Setting']['name'];$value = $setting['Setting']['value'];foreach($settings as $setting){Configure::write("$name", "$value");}}This is my setting Model :<?phpclass Setting extends AppModel {public $validate = array('name' => array('rule' => 'notEmpty'),'value' => array('rule' => 'notEmpty'));}And in my view I use :Configure::read('site.name')But it does'nt work... any idea ?
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