Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 19, 2022, 05:48:07 AM

Login with username, password and session length
Members
  • Total Members: 3843
  • Latest: Tricky
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 58
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 1
Guests: 54
Total: 55

Author Topic: Categories & Boards Info  (Read 11342 times)

0 Members and 1 Guest are viewing this topic.

ontap

  • Guest
Categories & Boards Info
« on: March 23, 2006, 08:48:24 PM »
Thought id share this with others, Add Both "Categories & Boards" Info To Forum Stats Block,
would love to see this added to the next beta  :coolsmiley:

EG:
Total Posts: 542167
Total Topics: 1024
Total Categories: 15
Total Boards: 50

Online Today: 66
Online Ever: 105

First Backup Your TPortalBlocks.template file  ;)

Open TPortalBlocks.template.php
Find:
Code: [Select]
// TPortal stats box
function TPortal_statsbox()
{
       global $context, $settings, $options, $scripturl, $txt, $modSettings;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
        echo'<table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>';
        echo '<td width="100%" valign="top" class="smalltext" style="font-family: verdana, arial, sans-serif;">';

       if(isset($context['TPortal']['userbox']['stats']))
   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>
                 <br />'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet.$txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';
       if(isset($context['TPortal']['userbox']['stats_all']))
   // more stats
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=stats"><b>'.$txt['tp-stats'].'</b></a>
                 <br />'.$bullet.$txt[489].': '.$modSettings['totalMessages']. '
  <br />'.$bullet. $txt[490].': '.$modSettings['totalTopics']. '
  <br />'.$bullet.$txt['tp-mostonline-today'].': '.$modSettings['mostOnlineToday'].'
  <br />'.$bullet.$txt['tp-mostonline'].': '.$modSettings['mostOnline'].'<br />
  ('.timeformat($modSettings['mostDate']).')
  ';

Replace With:
Code: [Select]
// TPortal stats box
// Modified By OnTap©
function TPortal_statsbox()
{
       global $context, $settings, $options, $scripturl, $txt, $db_prefix, $modSettings;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
        echo'<table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>';
        echo '<td width="100%" valign="top" class="smalltext" style="font-family: verdana, arial, sans-serif;">';

$result = db_query("
SELECT COUNT(ID_BOARD)
FROM {$db_prefix}boards", __FILE__, __LINE__);
list ($modSettings['boards']) = mysql_fetch_row($result);
mysql_free_result($result);

$result = db_query("
SELECT COUNT(ID_CAT)
FROM {$db_prefix}categories", __FILE__, __LINE__);
list ($modSettings['categories']) = mysql_fetch_row($result);
mysql_free_result($result);

       if(isset($context['TPortal']['userbox']['stats']))
   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>
                 <br />'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet.$txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';
       if(isset($context['TPortal']['userbox']['stats_all']))
   // more stats
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=stats"><b>'.$txt['tp-stats'].'</b></a>
                 <br />'.$bullet.$txt[489].': '.$modSettings['totalMessages']. '
     <br />'.$bullet. $txt[490].': '.$modSettings['totalTopics']. '
     <br />'.$bullet. $txt[658].': '.$modSettings['categories']. '
     <br />'.$bullet. $txt[665].': '.$modSettings['boards']. '
     <br />'.$bullet.$txt['tp-mostonline-today'].': '.$modSettings['mostOnlineToday'].'
     <br />'.$bullet.$txt['tp-mostonline'].': '.$modSettings['mostOnline'].'<br />
  ('.timeformat($modSettings['mostDate']).')
  ';


« Last Edit: March 28, 2006, 03:06:36 AM by OnTap© »

Xarcell

  • Guest
Re: Categories & Boards Info
« Reply #1 on: March 23, 2006, 08:54:46 PM »
Nice, I need that for one of my sites...

erikman

  • Guest
Re: Categories & Boards Info
« Reply #2 on: March 23, 2006, 11:30:21 PM »
Very nice, OnTap©

TwinsX2Dad

  • Guest
Re: Categories & Boards Info
« Reply #3 on: March 24, 2006, 12:03:47 AM »
Works perfectly. Thank you.

feline

  • Guest
Re: Categories & Boards Info
« Reply #4 on: March 24, 2006, 06:29:29 AM »
Total Posts: 542167
Total Topics: 1024
Total Categories: 15

Total Boards: 50

the better way to get all of this in ONE query ...
Code: [Select]
SELECT count(ID_BOARD) as boards,
       count(distinct(ID_CAT)) as cats,
       sum(numTopics) as topics,
       sum(numPosts) as posts
FROM smf_boards;

Fel

Offline bloc

  • Founder
  • *
  • Posts: 5229
    • Bloc
Re: Categories & Boards Info
« Reply #5 on: March 24, 2006, 06:43:20 AM »
topics, posts and members are already collected through SMF by default, so thats not really necessary. As for boards and categories I left it out because its easy enough to use the ssi function for a stats block..also making it a choice to collect that extra info on each pageload.

ontap

  • Guest
Re: Categories & Boards Info
« Reply #6 on: March 24, 2006, 02:05:40 PM »
As for boards and categories I left it out because its easy enough to use the ssi function for a stats block..also making it a choice to collect that extra info on each pageload.

i had it that way.. used both the stats block & Forum Stats block,
better to put it into one ;)

gamerxgirl

  • Guest
Re: Categories & Boards Info
« Reply #7 on: February 05, 2007, 02:45:17 PM »
Although this serves it purpose and displays the information as it's supposed to, it seems to create problems with my 'Pirates' theme by Aku. It displaces the footer of my theme, and brings it up and to the right, expanding the width of the page. Upon removing the code, everything is fine.

siath

  • Guest
Re: Categories & Boards Info
« Reply #8 on: March 07, 2007, 01:52:47 AM »
Ok ran into a problem...

Code: [Select]
// TPortal stats box
// Modified By OnTap©
function TPortal_statsbox()
{
       global $context, $settings, $options, $scripturl, $txt, $db_prefix, $modSettings;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
        echo'<table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>';
        echo '<td width="100%" valign="top" class="smalltext" style="font-family: verdana, arial, sans-serif;">';

Atleast on my theme MESH it made it eat the boxes before it. Changed it to...
Code: [Select]
// TPortal stats box
// Modified By OnTap©
function TPortal_statsbox()
{
       global $context, $settings, $options, $scripturl, $txt, $db_prefix, $modSettings;

        echo '<div style="padding: 5px;" class="smalltext">';

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';


****THEN AT BOTTOM MAKE SURE IT IS SET THIS WAY****
       }
    echo '</div>';
     }
    echo '</div>';
  }

This completely fix all my problems...
This could also be the problem with your theme gamerxgirl might try the fix see if it corrects it.

Siath

Texas Liberty Lady

  • Guest
Re: Categories & Boards Info
« Reply #9 on: November 27, 2007, 05:49:01 AM »
I'm sorry to be so far behind you guys but I like this mod and wnat it on my forum.  However, I have no block template.  Can you please help.  I am using the heavy metal theme.  Thanks so much.