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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 379
  • Total: 379

Top Stats - 3 in 1 Block

Started by akulion, November 04, 2006, 03:53:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RoarinRow

So strange.  I used this as a php center block and it worked.  An hour later all I see was the block title and no content   :o

This is the code I was using.  Any idea on what could be wrong?  I didn't make too many changes based on the code on the first post of this thread.

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Last 2 Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Week's Top Posters</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://www.avalanchestyle.com/forum/Themes/default/images/noavatar.gif" height=50 width=50><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td></tr>
</table>';

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

RoarinRow

Hahaha I figured it out!  It didn't like the apostraphe in this section of the code were I changed it to say, 'This Week's Top Posters'.  When I took out the apostraphe on the word 'Week's', the code worked     :idiot2:

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0


RvG

thank you thnak you thnak you... :)

RoarinRow

Quote from: Aku on January 13, 2007, 10:18:33 AM
lol :D

Didn't think that would effect the actual display of the code   :idiot2:    :2funny:

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

MeRcChRiS

how do i put this only on the frontpage like path-to-peace's frontpage where he has tons of stuff on it and they dont seem like articles?

akulion

My front page is all Blocks...
Some are PHP, some are Script blocks, but every single one is just basically a block.

My settings for the front page are:
- use only single page
- Normal, frontblocks are shown alone
- show left blocks, show center blocks
- All articles are set NOT to display on front page.

Thats about it really.
Hope it helps you out

MeRcChRiS

where is the - All articles are set NOT to display on front page.?

Lesmond

#28
you will find that under "Options" in  the edits for each article 

sorry it reads  "Show on front page:  No o  Yes o

MeRcChRiS

 MeRcChRiS   6
()
Master   1
()
Daikenkaiking   0
()
Scorpio   0
()
Jo.O   0
()

ok im getting () those on the bottom of each name. Im not sure how to get them around the numbers.

This website is proudly hosted on Crocweb Cloud Website Hosting.