Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Views XXXX (aka thread has been read XXXX times)

lamentlament
edited January 2006 in Vanilla 1.0 Help
Category Vanilla Started by mark Comments 3 Last comment by lech Last Active 1 day ago new 1 views 955


how much load on the server would it be to add the number of views a thread has?

Comments

  • Options
    unless there's some way of incrementing a field value when you run a SELECT query on the database; i'd assume you have to run an UPDATE query whenever someone views a thread. In which case it would put quite a lot of load onto the server as it would increase the number of queries run on each thread viewing by 50%. I think.
  • Options
    edited August 2005
    number of views total or number of views from yourself?

    either should be easy, but the total number of views won't include people who aren't logged in, of course.

    select count(LastViewed),DiscussionID from LUM_UserDiscussionWatch where DiscussionID='$DiscussionID' group by DiscussionID;

    that should take care of the sql.
  • Options
    dknowles, I don't allow to view the forum by unregistred users and I don't care about the server load (I have only 10-20 users and a root-server) What I want is to show the views per topic, a la "Category Random Started by minisweeper Comments 3 Last comment by Bergamot Last Active 30 minutes ago total views 112" I'm not good on sql or php (just basic understanding and editing) and really like to integrate this feature (a bit of control is sometimes not the worst thing ;-) ) Would be great if you could assist (well, okay, you would do the mainpart and I'll assist you...) me in doing this! Thank you very much!
  • Options
    edited January 2006
    Maybe I'm missing the point, but why not just:

    select count(LastViewed) from LUM_UserDiscussionWatch where DiscussionID='$DiscussionID';
    I mean, if you already know what DiscussionID is, why return it and group by it?
  • Options
    That wasn't for me I think...any advice for me?
  • Options
    *bump* :-(
  • Options
    MarkMark Vanilla Staff
    I actually don't record "times-viewed". The UserDiscussionWatch table is used to record how many comments within a discussion a user has read - this allows for the "X New" text on the discussion list. When a user clicks into a thread, the record is updated - I don't insert a new one. So, this would require a whole new extension with a whole new table.
This discussion has been closed.