TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 02, 2024, 02:07:21 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,176
  • Total Topics: 21,220
  • Online today: 120
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 94
  • Total: 94

Stats block for middle display

Started by joh87swe, April 11, 2007, 12:21:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

joh87swe

Hi,

The default TP stats block is perfect for left/right positions. But it do not fit when placed in the middle. Does someone know any code to have a horizontal stats block with number of topics, posts, members... the same as the default TP block but which fit the middle position.
Thanks for help.

Cordially,
Johan

akulion

#1
well here is one

Step 1: Turn off the Stats Block (the one that comes with TP)

Step 2: Create a center PHP block

Step 3: Place the following code in it:

// TPortal stats box
{
       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><tr><td><div 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 '</td><td>
                  <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']).')
  ';
echo'</td><td>';
       if(isset($context['TPortal']['userbox']['online'])){
   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';

            $online = ssi_whosOnline('array');
   echo $bullet.$txt['tp-users'].': '.$online['num_users'];
   echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];
   echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
   }
echo '</div>';
         }
echo '</div></td></tr></table>';
}


Step 4: Position the block and Activate the Block



akulion

ill try and make it a lil more beautiful...so keep a watch out for another updated here :up:

akulion

#3
here u go this is a lil better: demo: http://goofy-goobers.com/site/

// TPortal stats box
{
       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><tr><td valign="top"><div 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']).')
  ';
echo'</td><td width="1" bgcolor="#808080"></td><td valign="top" >';
       if(isset($context['TPortal']['userbox']['online'])){
   // add online users
            echo '<img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';

            $online = ssi_whosOnline('array');
   echo $bullet.$txt['tp-users'].': '.$online['num_users'];
   echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];
   echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<td  valign="top" width="1" bgcolor="#808080"></td><td valign="top">Online List<br>
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
   }
echo '</div>';
         }
echo '</div></td><td valign="top" width="1" bgcolor="#808080"><td valign="top">This is a space filler, you can place a small banner<br> here if you want or some general info - or whatever</td></tr></table>';
}


where it says:

This is a space filler, you can place a small banner<br> here if you want or some general info - or whatever


you can place whatever you want, just pay attention to the line breaks though (the BR thingie)

<br>


You can also place a small banner there if you want with a link and image tag like:

<a href="http://yoursite.com"><img src="http://yoursite.com/image.gif" border=0></a>


hope that helps:)

joh87swe