![]() |
How do you allow for site preferences? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html) +--- Thread: How do you allow for site preferences? (/thread-20344.html) |
How do you allow for site preferences? - El Forum - 07-06-2009 [eluser]tomdelonge[/eluser] I want the admin to login to the backend and be able to choose simple preferences, like "results per page" and such. I've heard of storing it in a db, but that seems slow (you'd have to read it every page display). What other ways do you guys accomplish this? How do you allow for site preferences? - El Forum - 07-06-2009 [eluser]Thorpe Obazee[/eluser] cookies? How do you allow for site preferences? - El Forum - 07-06-2009 [eluser]tomdelonge[/eluser] Sorry I mean like administration side (server side) not client side... How do you allow for site preferences? - El Forum - 07-07-2009 [eluser]Phil Sturgeon[/eluser] I do this in PyroCMS and it's not too bad. With a spot of DB caching and storing them results in the library object as you go (meaning two requests for site_name do not fire off too queries) I haven't really noticed an issue with speed. I spend all day working with a CMS that runs about 50 database connections and runs over 100 queries just for basic page layouts and content... I really don't think a few 1 line SELECTs are going to hurt anything. sql Code: CREATE TABLE `settings` ( You can mostly ignore is_gui and module, they are just to stop it showing up on the interface and module is a way to break down settings into tabs. lib model Hope thats of some help. How do you allow for site preferences? - El Forum - 07-07-2009 [eluser]Thorpe Obazee[/eluser] [quote author="tomdelonge" date="1246958144"]Sorry I mean like administration side (server side) not client side...[/quote] oh...ok. Anyway, I don't see how it's gonna be different from normally putting it in the controller. You just have to do another query for it. How do you allow for site preferences? - El Forum - 07-07-2009 [eluser]Phil Sturgeon[/eluser] Well yes it would boil down to a query in the end but this is a nice standard way of doing it. E.g: Code: $this->settings->item('site_name') How do you allow for site preferences? - El Forum - 07-07-2009 [eluser]Thorpe Obazee[/eluser] [quote author="Phil Sturgeon" date="1246971322"]Well yes it would boil down to a query in the end but this is a nice standard way of doing it. E.g: Code: $this->settings->item('site_name') I just got a deja vu when I saw that... How do you allow for site preferences? - El Forum - 07-07-2009 [eluser]jdfwarrior[/eluser] [quote author="Phil Sturgeon" date="1246966268"]I do this in PyroCMS and it's not too bad. With a spot of DB caching and storing them results in the library object as you go (meaning two requests for site_name do not fire off too queries) I haven't really noticed an issue with speed. I spend all day working with a CMS that runs about 50 database connections and runs over 100 queries just for basic page layouts and content... I really don't think a few 1 line SELECTs are going to hurt anything. sql Code: CREATE TABLE `settings` ( You can mostly ignore is_gui and module, they are just to stop it showing up on the interface and module is a way to break down settings into tabs. lib model Hope thats of some help.[/quote] agreed. |