Announcement

Collapse
No announcement yet.

How the "Thread View Counter" work?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How the "Thread View Counter" work?

    Hello...

    May i know how the thread view counter work?

    let say i open one thread with 3 pages, i open the 1st page, then page 2, then page 3, the counter count 3 view or 1 view only?

    Thanks

  • #2
    Looking at the code, it seems to add one every time showthread.php is called, so for your example that would be 3 views.

    Comment


    • #3
      Oh okey.. may i know where is the code located? in showthread.php? line number? just want to make sure.

      Thanks alot

      Comment


      • #4
        Yes, it's in showthread.php. It looks like this (line 517 or so):
        PHP Code:
        // *********************************************************************************
        // update views counter, moved after seo re-direct.
        if ($vbulletin->options['threadviewslive'])
        {
            
        // doing it as they happen; for optimization purposes, this cannot use a DM!
            
        $db->shutdown_query("
                UPDATE " 
        TABLE_PREFIX "thread
                SET views = views + 1
                WHERE threadid = " 
        intval($threadinfo['threadid'])
            );
        }
        else
        {
            
        // or doing it once an hour
            
        $db->shutdown_query("
                INSERT INTO " 
        TABLE_PREFIX "threadviews (threadid)
                VALUES (" 
        intval($threadinfo['threadid']) . ')'
            
        );


        There are two possibilities, depending on whether or not you have "Update Thread Views Immediately" set to Yes or No in the admincp (under "Server Settings and Optimization Options").
        Last edited by kh99; Sun 2 Feb '14, 4:04am.

        Comment


        • #5
          Thank you very much kh99

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X