![]() |
Config Class, recomendation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Config Class, recomendation (/showthread.php?tid=27989) |
Config Class, recomendation - El Forum - 02-26-2010 [eluser]sn4k3[/eluser] First what you guys recommend for save/write configs for be acessed every time does config class support write and read arrays? also what you think is better: standart_user.php (Store all prices, winnings for a normal user) premium_user.php(Store all prices, winnings for a Prmium user) OR user_settings.php | |>> Store an array( array(0 => array(), 1 => array()) ) 0 = Standart user 1 = Premium user Thanks Config Class, recomendation - El Forum - 03-02-2010 [eluser]farinspace[/eluser] Use a database! If you cant use MySQL, use SQLite ... Config Class, recomendation - El Forum - 03-02-2010 [eluser]sn4k3[/eluser] is that the best way? Renember every time a user request a page, i have to retrieve that information, so it will not overload MySQL? Config Class, recomendation - El Forum - 03-02-2010 [eluser]farinspace[/eluser] Thats what a database is used for ... additionally you can use sessions to store data during a users visit, this can also help alleviate the database load ... ... and as your site grows you will definitely learn/know more and you can begin looking into page/content caching strategies to reduce stress on the database (but that should come around when you have several thousands of requests per day, thats a good problem to have!) Config Class, recomendation - El Forum - 03-02-2010 [eluser]sn4k3[/eluser] session? its global settings, not settings per user is just like define site name, site email, etc, etc Config Class, recomendation - El Forum - 03-02-2010 [eluser]farinspace[/eluser] Ah ... i've done a couple of different things in this situation: 1) I've saved site specific items in the "config.php" file itself (which really shouldn't be a problem, you'll never have thousands of config parameters anyway) 2) I've created a specific DB table "site_details" (fields: name, value), kinda like a meta data table ... and saved name value pairs in it, then I created a model to easily retrieve specific and/or all values. You could then use a base controller to distribute the values globally. If your pages will be static in some respects, then you can use CI page caching to also improve performance. When you change values, you can manually clear the cache ... I hope i'm on the same page now ... ![]() Config Class, recomendation - El Forum - 03-02-2010 [eluser]Twisted1919[/eluser] Take a look here , this is what i use : Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Config Class, recomendation - El Forum - 03-02-2010 [eluser]Twisted1919[/eluser] I used Phil Sturgeon's caching library .( http://github.com/philsturgeon/codeigniter-cache ) So you query the database only once, then you get everything from cache . Makes sense to you ? Config Class, recomendation - El Forum - 03-02-2010 [eluser]sn4k3[/eluser] yes, thanks to all |