Re: Marking comments as read

2010-01-28 Thread asbestospiping
That makes a lot of sense, I think it puts me on the right track.

On Jan 27, 7:47 pm, cricket  wrote:
> > and removing the viewed rows in the db when a comment is added
>
> I don't understand what you mean by that. If it's what I think then
> I'd guess it would require a lot of writes to the DB.
>
> I did put something together last night. It's a bit rough around the
> edges but it's a start. It involves code from a bunch of files, so you
> can check it out here:
>
> http://pastebin.ca/1768372
>
> My first inclination was to create a behavior. Even though there are
> two models involved directly--Post & Comments--I thought it could be
> done. But I need access to the Session. I've chosen to pass it from
> the controller to Post model. It's a cheat, but I can't think of any
> way (that would be better) to do this with a behavior.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Marking comments as read

2010-01-27 Thread cricket
> and removing the viewed rows in the db when a comment is added

I don't understand what you mean by that. If it's what I think then
I'd guess it would require a lot of writes to the DB.

I did put something together last night. It's a bit rough around the
edges but it's a start. It involves code from a bunch of files, so you
can check it out here:

http://pastebin.ca/1768372

My first inclination was to create a behavior. Even though there are
two models involved directly--Post & Comments--I thought it could be
done. But I need access to the Session. I've chosen to pass it from
the controller to Post model. It's a cheat, but I can't think of any
way (that would be better) to do this with a behavior.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Marking comments as read

2010-01-27 Thread asbestospiping
Its a good idea, but i want to be able to see when a user has viewed a
comment, and then act upon that at the end of the day. The solution
i'm going with is tracking the post views, as opposed to the comment
views, and removing the viewed rows in the db when a comment is added.
any thought?

On Jan 26, 9:20 pm, cricket  wrote:
> I think the most efficient thing to do would be to update a timestamp
> whenever a user views a post. Maybe have a posts_users table with an
> extra column and use contain to include it in your results. Update the
> column in afterFind() maybe?
>
> Then, in the view, compare the original ts that you got from your find
> () with the Comment.created value. Any newer comments get a class
> "NewComment".
>
> I've never done this, btw. But I happen to be just starting on a
> posts_controller. I think I'll give it a go.
>
> On Jan 26, 11:31 am, asbestospiping  wrote:> Hi 
> all, I am trying to do something, and cant work out where to start.
> > I have the blog app running, and have the comments paginated under the
> > post. I have auth working, and would like to track when a user views a
> > comment (Think marking as read)
>
> > I have a db table viewedcomments, with the fields id, user_id,
> > comment_id
>
> > I simply want to add the relevent data when a comment is displayed,
> > either on its own, or as part of the post page.
>
> > Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Marking comments as read

2010-01-26 Thread cricket
I think the most efficient thing to do would be to update a timestamp
whenever a user views a post. Maybe have a posts_users table with an
extra column and use contain to include it in your results. Update the
column in afterFind() maybe?

Then, in the view, compare the original ts that you got from your find
() with the Comment.created value. Any newer comments get a class
"NewComment".

I've never done this, btw. But I happen to be just starting on a
posts_controller. I think I'll give it a go.

On Jan 26, 11:31 am, asbestospiping  wrote:
> Hi all, I am trying to do something, and cant work out where to start.
> I have the blog app running, and have the comments paginated under the
> post. I have auth working, and would like to track when a user views a
> comment (Think marking as read)
>
> I have a db table viewedcomments, with the fields id, user_id,
> comment_id
>
> I simply want to add the relevent data when a comment is displayed,
> either on its own, or as part of the post page.
>
> Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Marking comments as read

2010-01-26 Thread John Andersen
Can I understand that you are only showing one comment at a time, even
together with a post?

In case that is correct, then one solution is to specific read all the
ViewedComment records for the post and the user, and ask in the view,
is the current comment in the ViewedComment array of records.
If it is, then show current comment in one colour or whatever you
want.

Another is to include the ViewedComment records in the Comment set
using a hasMany relationship with condition that the user_id equals
the current user. Then act upon it in the view.

Hope this gives you some ideas, enjoy,
   John

On Jan 26, 6:31 pm, asbestospiping  wrote:
> Hi all, I am trying to do something, and cant work out where to start.
> I have the blog app running, and have the comments paginated under the
> post. I have auth working, and would like to track when a user views a
> comment (Think marking as read)
>
> I have a db table viewedcomments, with the fields id, user_id,
> comment_id
>
> I simply want to add the relevent data when a comment is displayed,
> either on its own, or as part of the post page.
>
> Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Marking comments as read

2010-01-26 Thread asbestospiping
Hi all, I am trying to do something, and cant work out where to start.
I have the blog app running, and have the comments paginated under the
post. I have auth working, and would like to track when a user views a
comment (Think marking as read)

I have a db table viewedcomments, with the fields id, user_id,
comment_id

I simply want to add the relevent data when a comment is displayed,
either on its own, or as part of the post page.

Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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