SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    "Trust Me." gladding's Avatar
    Join Date
    Oct 2002
    Location
    Folsom, California
    Posts
    399
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Active Topics List

    I'm trying to figure out how to code an active topics list (like on the front of Sitepoint)... does anyone know of an article or tutorial out there?

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I take it you mean for Invision Board, yeah?

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  3. #3
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    You could probably get a pre-made MOD to do that, have a look here.

  4. #4
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, I was thinking of this one day, you are talking about something that calculates the most 'hot' topic right ?
    Maybe it's just me but I did this a little complicated
    Here is how I would do it (note not tested!):

    Fist I select unix timestamp time of all posts (threads and replys) on the board the last 3 days.
    Then I calculate the unix timestamp value of the exact same time 3 days ago and I round() that value to minutes (devide by 60), lets call that value $x. Then for each row (post) I get from the database I do the following:
    round() the unix timestamp into minutes, lets call that $y.
    then I take $y - $x = $y
    then I take $y to the power of 2, and assign that to the $y variable.
    then I take the $y and devide it by 1000 and use ceil()
    then for each thread I sum up the value of $y that all posts got and then I multiply that value with the square root of the number of posts in that thread.
    PHP Code:
    Example Unix timestamp of post1051975886
    Example current Unix timestamp
    1051978951

    60 
    24 4320 //calculate the minutes in 3 days

    //calculate the minutes since 1970 until 3 days ago
    round((1051978951 60)) - 4320 17528663

    //get the time in minutes after 3 days ago when the post was submitted
    round((1051975886 60)) - 17528663 4268

    //place that time in the power of 2 so posts that were posted sooner are more important then old ones
    4268 77745136832
    //devide by 1000 and raise the value to integer
    ceil((77745136832 1000)) = 77745137

    //then sum up all these values that belong to each thread
    //and then multiply the result by the square root of the number of replies 
    I have not tried this but at the time I wrote it I thought a lot about how to do this thing, that is calculate the 'hottest' topic and I belive this works, note that your board needs a bit of activity so that this could work.

    Hope that helps
    - website


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •