Tuesday, October 1, 2013

Using Dispatcher Filters to setup site settings in plugin bootstrap

Hello,
I've decided to store site settings in db and then cache them. So I created Settings plugin with SettingsController, now my question is can I use (and how) Dispatcher Filters to setup site settings when plugin is loaded ? So after plugin is loaded I want to call setup method, which setups site settings using Configure::write().

Now Im doing this, this way ? Is that ok ?

Plugin bootstrap :

App::uses('SettingsController', 'Settings.Controller');

Configure::write('Dispatcher.filters', array(
    'Settings.setup' => array('callable' => array(new SettingsController(), 'setup'), 'on' => 'before', 'priority' => 1)
));

How can i do it ?
Thanks for any help


 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: