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:
// 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:
// 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']).')
';
Nice, I need that for one of my sites...
Very nice, OnTapÂÃ,©
Works perfectly. Thank you.
Quote from: OnTapÂÃ,© on March 24, 2006, 03:48:24 AM
Total Posts: 542167
Total Topics: 1024
Total Categories: 15
Total Boards: 50
the better way to get all of this in ONE query ...
SELECT count(ID_BOARD) as boards,
count(distinct(ID_CAT)) as cats,
sum(numTopics) as topics,
sum(numPosts) as posts
FROM smf_boards;
Fel
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.
Quote from: Bloc on March 24, 2006, 01:43:20 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 ;)
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.
Ok ran into a problem...
// 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...
// 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
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.
All the TP templates are in the default theme.
Quote from: siath on March 07, 2007, 08:52:47 AM
Ok ran into a problem...
// 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...
// 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
this was the fix i needed for darkdirge theme. thanks!