aWebDeveloper
aWebDeveloper

Reputation: 38352

Retrieve configurations that are saved in db

I saved all my system wide configurations in db. How do i make the configurations that I have saved in db available everywhere. These need to be available everywhere --in the model, view, controller, component, element etc.

Upvotes: 0

Views: 49

Answers (1)

Scott Harwell
Scott Harwell

Reputation: 7465

Are you trying to override the Configure::write() function with values that you are storing in the DB? If not, then create a Settings model for your external settings and then pull that data when you need it in the controller. You can then pass those settings to a view (and in turn elements), by following the normal MVC process.

Follow this process:

  1. Create Settings Model
  2. Add model to AppController's $uses array
  3. Perform a find for the settings in your controller -- now the data is there
  4. Pass the settings data to your view $this->set('settings', $settings);

Upvotes: 1

Related Questions