How do you allow for site preferences? |
[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?
[eluser]tomdelonge[/eluser]
Sorry I mean like administration side (server side) not client side...
[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.
[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.
[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')
[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...
[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. |
Welcome Guest, Not a member yet? Register Sign In |