Welcome Guest, Not a member yet? Register   Sign In
Storing System Settings
#1

[eluser]jbuk[/eluser]
Hi All,

I've recently started building an application with Code Igniter and love it so far. I'm developing a multi-tenant application so that different users have their own instances of a single application, i.e. company1.mysite.com, company2.mysite.com.

To do this I need to load settings specific to that company into the app, i.e. site name, logo url etc. Should this data be stored in session? It seems an overkill, I was thinking of using a model/library but as the same application supports multiple users I am concerned that will overwrite another instance.

Any help would be greatly appreciated, thanks
#2

[eluser]johnpeace[/eluser]
Check out the pro version of PyroCMS...it's multi-site manager does what you're describing.
#3

[eluser]CroNiX[/eluser]
I created a very simple library that stores/retrieves settings from a database, to store dynamic data like you are describing. I just have it autoload. It basically gets all data from the database config table and stores it in a multidimensional array that is then globally accessible.

like
Code:
//get all settings for 'image_settings' category
$image_settings = $this->site_config->get_category('image_settings');
returns array similar to
Code:
array(
  [max_width] = 200,
  [max_height] = 150
)
or
Code:
//get max height from image category
$image_height = $this->site_config->value('image_settings', 'max_height');

returns string similar to '150'

Something simple like this would be very easy to create. In the construct, it retrieves all data from the database and creates the array.






Theme © iAndrew 2016 - Forum software by © MyBB