brian,
I think you are trying to hard to formulate and verify data. (btw when i
said hash previously I actually meant to say serialized data ... late hours)
- plus, I now think that there is no need to use a cookie (other than
typical session id, login status) - the user should know if they read a
thread already so storing that data in the db makes more sense if they use
multiple computers to access that forum (students, teachers, etc)
So let's say for the sake of example your serialized data is essentially an
array
$read_threads =
array(array('thread_id'=>12),array('last_date_visited'),array('thread_id'=>16),array('last_date_visited'))
when the list of threads is displayed you check against the
last_visited_date for the specific thread ID
foreach($read_threads as $n=>$v){
if($thread($v['thread_id'])->messages->last_post_date() >
$v['last_date_visited'])
//print out the right icon, or set the appropriate status variable
for use in smarty, etc
the foreach (or a regular for) works perfectly fine because you would use
that anyways to print the list of threads
then when they view a page of the thread's messages you update the
array/object/session with the last post date of that thread, save to the db
anyways, thats what i was thinking.
On Wed, Jan 21, 2009 at 1:17 PM, brian <[email protected]> wrote:
>
> On Wed, Jan 21, 2009 at 12:43 AM, Brian Williams <[email protected]>
> wrote:
> > not to step on toes but i'm not sure why it's such a problem storing that
> > data in a db...
> >
> > if you want quick access to the data but not a zillion records make a
> hash,
> > and store that hash in the db and a cookie.
> >
> > when the user logs in, read the hash and store into their session and
> save
> > it in their cookie until they log out.
>
> That seems like a good idea, but how would you get the thread IDs from
> a hash? The only way I can see that working is if you hashed every
> combination of thread IDs (plus whatever user-specific info you
> previously hashed) and tested against what was stored in the cookie.
> Obviously, that wouldn't be very efficient. What did you have in mind?
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---