Store site configuration on database |
[eluser]itibook[/eluser]
Hi all, pretty new here, so feel free to some links if you think I missed something. Just to be clear I spent a couple of hours on the forum and google, but couldn't find an answer, so that's why I am posting... I would like to be able to set some basic configuration fields (e.g. website name, website email, etc) in a database table and make sure that they get loaded at each page so that I can re-user those value in each model/view. The end game is to have those configuration settings editable in the admin panel. It's not rocket science, I am sure, but I can't seem to grasp where and how I should do that. thanks in advance Luca
[eluser]GSV Sleeper Service[/eluser]
sounds like a perfect use for hooks. http://ellislab.com/codeigniter/user-gui...hooks.html
[eluser]itibook[/eluser]
Thanks. It looks indeed like the right match, I will search better on that side. Thanks again
[eluser]itibook[/eluser]
just posting here in case anyone else has the same problem and looks for a solution: I found this two links that gave me the direction... http://www.echovsprint.com/2009/04/role-...ing-hooks/ http://codeigniterandjquery.blogspot.com...in-ci.html I settled for having a hook that retrieves the settings from my database and defines them as constants so that I can call each setting from any MVC again thanks GSV Sleeper Service for giving me the right direction... ciao Luca
[eluser]Dark Preacher[/eluser]
I'll try to suggest my own solution, as I've done before (and doing now). First create table "preferences" in your database: Code: CREATE TABLE `preferences` ( Code: function get_pref($name){ Code: <title><?=$this->m_common->get_pref('site_name')?></title>
[eluser]itibook[/eluser]
Hi Dark Preacher, I am basically doing the same, but with the hooks solution suggested it means that the preferences are always available as they are loaded before anything else, basically they are like config variables. anyway, thanks for the suggestion, hadn't thought of it, so it might come in handy for other cases. ciao Luca |
Welcome Guest, Not a member yet? Register Sign In |