I've built a system called "Register" who manage a table with a key=>value logic with a little complex "key" definition.
A key is generally a meaningfull string such "elementsPerPage", "applicationName", etc... This string is an unique identifier in Register. To reach a more sophisticated level of definition I attach to my key an "area" contextualization. An area consist in another string who restrict the "key point of view". This way you can define a general "appName" used for entire website and define a "users.appName" who change the context of my key. In the end I want to use a localizable info so my key+area is completed with a "lang" identifier to reach a value in a very meaningull (but simple) notation: "appTitle" => My Web Site Application "users.appTitle" => My User Management Application "it.usersAppTitle" => Gestione Utenti This is a simple logic system. You can implement it with a model or a compontent: the choise is your! On Sep 3, 9:41 am, Martin Westin <martin.westin...@gmail.com> wrote: > I'd say that what is best depends on how many preferences you > anticipate in your application. > > One field per preference in the user's table works fine for a very few > but can start looking messy after a while. > > I have seen e-commerce applications with 50+ fields in the products > table (is_hardware, amd_socket_compatible, usb, ...). The "amd" > boolean is only relevant for motherboards and CPUs, "usb" only for > external disks and other peripherals. They work but to me it just > looks a mess. :) > > If you think you will be adding a bunch of other preferences soon then > you might want to think of a more flexible setup. > > When things are just a little more complex that 2-3 preferences I have > used a serialized array in a single field. This has major drawbacks if > you ever want to query the data but for preferences I have sometimes > chosen them because they can store hierarchies of preference data. > This would be comparable to data in a Cake session or the Configure > class only stored in the database. > > If you anticipate more preferences and possible more dynamic data > stored you can look at a technique where you have a table that stores > key, value pairs linked to the User. That way only set and relevant > preferences will be stored but there might be a bit more sql trickery. > I use this when I import meta-data from uploaded files and the kinds > and amount of data can vary greatly. This will sort-of be a virtual > dynamic table of a table. There was some posts about it last fall or > winter... might find them in a search. > > /Martin > > On Sep 2, 7:01 pm, "Dave Maharaj :: WidePixels.com" > > <d...@widepixels.com> wrote: > > I have a Posts section which has a bookmark feature for users to save the > > posts they like.... > > > Now I want to add a preferences section to the users table with a field > > "display" which will be a bool true / false so when they view posts it will > > either pull all posts or ones they have not bookmarked only based on the > > "display" value and pass those posts to pagination. > > > What would be the best way to do this? > > > I was thinking: > > in the query I have contain bookmark which gets the post_id > > so if the Bookmark.post_id is in the Post.id remove it from the array > > > What would anyone suggest? > > > thanks > > > Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---