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: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 455
  • Total: 455

Top Posters - Post Count

Started by ontap, March 24, 2006, 07:17:59 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

JPDeni

You'll have to post the code you used in order for us to know how to alter it. Please use [ code ] tags around your code to make it easier to read.

DarkAngel612

um...i used the php block and inserted this code:

ssi_topPoster(10); 

that is all

IchBin

Yes, but if you altered it we need to see it.

JPDeni

#53
You said earlier
Quoteonly changing 1 line in the ssi file

We need to know which line you changed and what you changed it to.

Also, it would help if you would give a link to a site where we can see it in action. Often it helps to figure out the source of problems when we can look at the source code of the page.

DarkAngel612

Sorry about that...totally forgot that part, ok lets see Find it DreamSlayer Artworks and it shows up the same way on all our forums where I made the php block.

first I got this code from the first page of this post ...this is only partially the code on the page for I did the entire code change and it did not work soooooo

then I just replaced the $topNumber from the number to 10 and the 'link' and 'posts' lines from the top section with the 'link' line from bottom section

Look for:  (in SSI,php)

// Show the top poster's name and profile
function ssi_topPoster($topNumber = 1, $output_method = 'echo')
{
global $db_prefix, $scripturl;

// Find the latest poster.
$request = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
ORDER BY posts DESC
LIMIT $topNumber", __FILE__, __LINE__);
$return = array();
while ($row = mysql_fetch_assoc($request))
$return[] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],

------> 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'posts' => $row['posts']
);


Replace with:
// Show the top poster's name and profile link.
// Theres no post count... so lets show it
function ssi_topPoster($topNumber =3, $output_method = 'echo')
{
global $db_prefix, $scripturl;

// Find the latest poster.
$request = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
ORDER BY posts DESC
LIMIT $topNumber", __FILE__, __LINE__);
$return = array();
while ($row = mysql_fetch_assoc($request))
$return[] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],


---------> 'link' => '<table border="0" cellpadding="0" cellspacing="3" width="100%"><font size="1"><td><a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">  ' . $row['realName' ] . '</a></td><td align="right">' . $row['posts' ] . '</font><br></td></table>',
);


hope that helps...if not I am attaching the ssi.php file also




ScoobyDan

I amended the SSI.php code to the following:

// Show the top poster's name and profile link.
// Theres no post count... so lets show it
function ssi_topPoster($topNumber = 3, $output_method = 'echo')
{
global $db_prefix, $scripturl;

  echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">';

// Find the latest poster.
$request = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
ORDER BY posts DESC
LIMIT $topNumber", __FILE__, __LINE__);
$return = array();
while ($row = mysql_fetch_assoc($request))
$return[] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<tr><td class="smalltext"><a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">  ' . $row['realName' ] . '</a></td><td align="right" class="smalltext">' . $row['posts' ] . '</td></tr>',
);
mysql_free_result($request);

// Just return all the top posters.
if ($output_method != 'echo')
return $return;

// Make a quick array to list the links in.
$temp_array = array();
foreach ($return as $member)
$temp_array[] = $member['link'];

echo implode($temp_array);
echo '</table>';
}


Seems to have fixed the text size, gap between rows and following block title issues 8)

JPDeni

I'm not sure what's going on. Sorry that I missed your post on the 25th. I did look at your site, though, and found a number of issues.

This is what that line from SSI.php should look like, if you want each one to be in its own table:


'link' => '<table border="0" cellpadding="0" cellspacing="3" width="100%"><tr><td><a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName' ] . '</a></td><td align="right">' . $row['posts' ] . '</td></tr></table>',


I'm not sure where the comma is coming from. It wasn't in the SSI.php code that you posted. You might need to post the exact code that you're using for the block.

DarkAngel612

well what i posted is the actual file and what I changed


the actual block in TP mod is a php block

ssi_topPoster(10); 

is what it has inserted and nothing else.

I have no idea where that darn comma is coming from either....it is in the blocks that I have for all the forums that have TP and are post count oriented...also in my test forum that has hardly any posting cause it ismy playground to try then add to the manor later.

IchBin

I wonder if your version of PHP is doing this. I just tried your ssi code and the call in a block on my site and didn't get a comma. Try using this code instead and see if you have a comma.

// Show the top poster's name and profile link.
// Theres no post count... so lets show it
function ssi_topPoster($topNumber = 3, $output_method = 'echo')
{
global $db_prefix, $scripturl;

  echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">';

// Find the latest poster.
$request = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
ORDER BY posts DESC
LIMIT $topNumber", __FILE__, __LINE__);
$return = array();
while ($row = mysql_fetch_assoc($request))
$return[] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<tr><td class="smalltext"><a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">  ' . $row['realName' ] . '</a></td><td align="right" class="smalltext">' . $row['posts' ] . '</td></tr>',
);
mysql_free_result($request);

// Just return all the top posters.
if ($output_method != 'echo')
return $return;

// Make a quick array to list the links in.

foreach ($return as $member)
echo $member['link'];


echo '</table>';
}

Ianedres

There is a trailing comma after the 'link' key...

'link' => '<table border="0" cellpadding="0" cellspacing="3" width="100%"><font size="1"><td><a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">  ' . $row['realName' ] . '</a></td><td align="right">' . $row['posts' ] . '</font><br></td></table>',

But I wouldn't think it would matter, though.

The comma appears after the closing </table> in the HTML code... but I don't see where it should pop up in the php code.

Also, the implode function doesn't specify a glue separator (but, since 4.3.0, is optional) but I wonder if his server is running a prior version that may default to commas between the elements?

This website is proudly hosted on Crocweb Cloud Website Hosting.