Total number of READS on Community

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neal007
    Senior Member
    • Oct 2001
    • 522
    • 4.2.x

    Total number of READS on Community

    Is there a variable for the NUMBER OF READS for the entire forum?

    I want membercount, threadcount, postcount, and readcount for the entire forum.

    Thanks!
    Neal Culiner
    President, NC Software, Inc.
    Logbook Pro Pilot Flight Logbook Software
    Visual Basic Developer Forums
  • tubedogg
    Senior Member
    • Feb 2001
    • 13602

    #2
    You mean the total number of views? There's no built-in variable to do that, no. You could do something in your PHP include template though...


    $views = $DB_site->query_first("SELECT sum(views) AS views FROM thread");
    $totalviews = $views[views];

    Comment

    • George L
      Former vBulletin Support
      • May 2000
      • 32996
      • 3.8.x

      #3
      check www.vbulletin.org for a the total thread views hack which i also installed at http://animeboards.com/index.php?s=
      :: Always Back Up Forum Database + Attachments BEFORE upgrading !
      :: Nginx SPDY SSL - World Flags Demo [video results]
      :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

      Comment

      • neal007
        Senior Member
        • Oct 2001
        • 522
        • 4.2.x

        #4
        Works great, now how do I format the number to be like 49,888 (i.e. it puts in the comma).

        Thanks a bunch!!!
        Neal Culiner
        President, NC Software, Inc.
        Logbook Pro Pilot Flight Logbook Software
        Visual Basic Developer Forums

        Comment

        • neal007
          Senior Member
          • Oct 2001
          • 522
          • 4.2.x

          #5
          Found it at php.net (how resourceful I am ehh?)

          number_format($mynumber);
          Neal Culiner
          President, NC Software, Inc.
          Logbook Pro Pilot Flight Logbook Software
          Visual Basic Developer Forums

          Comment

          • Chen
            Senior Member
            • Jun 2001
            • 8388

            #6
            Resourceful, lol.
            Chen Avinadav
            Better to remain silent and be thought a fool than to speak out and remove all doubt.

            גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

            Comment

            • George L
              Former vBulletin Support
              • May 2000
              • 32996
              • 3.8.x

              #7
              Originally posted by FireFly
              Resourceful, lol.
              yup
              :: Always Back Up Forum Database + Attachments BEFORE upgrading !
              :: Nginx SPDY SSL - World Flags Demo [video results]
              :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

              Comment

              • Freddie Bingham
                Former vBulletin Developer
                • May 2000
                • 14057
                • 1.1.x

                #8
                I have this in my phpinclude template but I don't get more than 20,000 views a day so it's resource usage is nil.
                PHP Code:
                $fviews $DB_site->query_first("SELECT today, maxviews, totalviews, dailyviews
                                          FROM views"
                );
                $dailyviews $fviews[dailyviews] + 1;
                $totalviews $fviews[totalviews] + 1;
                $maxviews $fviews[maxviews];
                $ftoday date('Y-m-d');
                if (
                $ftoday != $fviews[today]) { // Update date
                  
                if ($dailyviews $maxviews) {
                    
                $maxviews $dailyviews;
                  }
                  
                $DB_site->query("UPDATE LOW_PRIORITY views
                                            SET today = '
                $ftoday',
                                            dailyviews = 1,
                                            totalviews = totalviews + 1,
                                            maxviews = '
                $maxviews'");
                } else { 
                // date is ok
                  
                $DB_site->query("UPDATE LOW_PRIORITY views
                                            SET dailyviews = dailyviews + 1,
                                            totalviews = totalviews + 1"
                );

                Code:
                CREATE TABLE views (
                  dailyviews int(10) unsigned NOT NULL default '0',
                  totalviews int(10) unsigned NOT NULL default '0',
                  maxviews int(10) unsigned NOT NULL default '0',
                  today date NOT NULL default '0000-00-00'
                ) TYPE=MyISAM;

                Comment

                • Kaizen
                  Senior Member
                  • Aug 2001
                  • 1884

                  #9
                  Thx

                  I am going to have to use this.
                  Email: [email protected]
                  Site: Under Construction

                  Comment

                  • Chen
                    Senior Member
                    • Jun 2001
                    • 8388

                    #10
                    Me too.

                    Thanks.
                    Chen Avinadav
                    Better to remain silent and be thought a fool than to speak out and remove all doubt.

                    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                    Comment

                    • neal007
                      Senior Member
                      • Oct 2001
                      • 522
                      • 4.2.x

                      #11
                      Where can I see this in action before I code it?
                      Neal Culiner
                      President, NC Software, Inc.
                      Logbook Pro Pilot Flight Logbook Software
                      Visual Basic Developer Forums

                      Comment

                      • Freddie Bingham
                        Former vBulletin Developer
                        • May 2000
                        • 14057
                        • 1.1.x

                        #12
                        at the bottom of my forum?

                        Comment

                        • neal007
                          Senior Member
                          • Oct 2001
                          • 522
                          • 4.2.x

                          #13
                          That does look nice!

                          I'm new to vBulletin, php, mysql. I'm a Win2K, VB programmer, using SQL Server.

                          Where do I go to create the views table? Again, using Windows 2K, if that matters.

                          Thanks!
                          Neal Culiner
                          President, NC Software, Inc.
                          Logbook Pro Pilot Flight Logbook Software
                          Visual Basic Developer Forums

                          Comment

                          • neal007
                            Senior Member
                            • Oct 2001
                            • 522
                            • 4.2.x

                            #14
                            Freddie,

                            Can I suggest formatting your numbers to show the comma in the thousands place:

                            number_format($mynumber);
                            Neal Culiner
                            President, NC Software, Inc.
                            Logbook Pro Pilot Flight Logbook Software
                            Visual Basic Developer Forums

                            Comment

                            • Freddie Bingham
                              Former vBulletin Developer
                              • May 2000
                              • 14057
                              • 1.1.x

                              #15
                              Well, yes, I could do that..but you know different countries use different characters for the separator so using none doesn't confuse anyone.

                              Comment

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