I have this code installed from this post:
http://www.tinyportal.net/index.php?topic=31670.0
I have had to turn off the block cause it is (after testing blocks) the one that is giving me this error:
[26-May-2012 15:27:31] PHP Parse error: syntax error, unexpected ',' in Themes/default/TPsubs.template.php(127) : eval()'d code on line 31
I have been getting this error in the admin section but since turning off the block it went away---wait for it---
turned on the block and removed code for avatars to show, and it still works but even though the error is no longer in admin section error log it is NOW appearing on the servers error_log.
I have removed all files for SMF 2.0 and uninstalled ALL pkgs. Reuploded the SMF files, reinstalled most of the pkgs, decided a few were not really needed and that has taken care of a lot of the errors this sillly forum has been giving out, so all files are brandspanking new. Ran updater files just in case --thanking Skhilled for his wonderful help so far
now the only other difference (actually before the removal of avatars from code) is this line:
old line: WHERE show_online = 1
my line: WHERE ' .($context['user']['is_admin'] ? '1' : 'show_online = 1') . '
any idea why it is not behaving or giving this error
here is the code I am trying to use without the avatar, so I may have muffed it up too ---also is there anyway to make the entries inline vs how they show now?
global $smcFunc, $scripturl, $modSettings, $context;
// Number of top posters displayed
$topPoster = 29;
// Find the latest poster.
$request = $smcFunc['db_query']('', '
SELECT mem.id_member, mem.show_online, mem.real_name, mem.posts, a.id_attach, a.attachment_type, a.filename
FROM ({db_prefix}members as mem)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE ' .($context['user']['is_admin'] ? '1' : 'show_online = 1') . '
ORDER BY posts DESC
LIMIT {int:limit}',
array('limit' => $topPoster)
);
$users = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$users[] = array(
'id' => $row['id_member'],
'name' => $row['real_name'],
'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'posts' => $row['posts'],
'show' => $row['show_online'],
);
}
$smcFunc['db_free_result']($request);
// Output our array of users with avatar, posts, and name
echo '
<table cellpadding="0" cellspacing="8">';
foreach ($users as $user)
{
echo '
<tr>
<td><h5 style="margin: 4px;">'.$user['link'].'</h5><h5 style="margin: 4px;">'. $user['posts'] .'</h5></td>
</tr>';
}
echo '
</table>';
Ah! So it was a bad block after all. ;)
yup this is the naughty one
I don't see any error in the code you posted. Is that copied from your block? Line 31 in your code is blank line, so that leads me to think that your code that you posted isn't exactly as you have it in your block, or you pasted the wrong code here.
If you want the output inline you just need to edit the table code at the bottom. Don't be afraid to give things a try since you always have a backup copy of your code. :)
This line?
<td><h5 style="margin: 4px;">'.$user['link'].'</h5><h5 style="margin: 4px;">'. $user['posts'] .'</h5></td>
</tr>';
Do I make it like this for inline:
<td><h5 style="margin: 4px;">'.$user['link'] . $user['posts'] .'</h5></td>
</tr>';
something like that?
this is copy/paste from block
global $smcFunc, $scripturl, $modSettings, $context;
// Number of top posters displayed
$topPoster = 29;
// Find the latest poster.
$request = $smcFunc['db_query']('', '
SELECT mem.id_member, mem.show_online, mem.real_name, mem.posts, a.id_attach, a.attachment_type, a.filename
FROM ({db_prefix}members as mem)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE ' .($context['user']['is_admin'] ? '1' : 'show_online = 1') . '
ORDER BY posts DESC
LIMIT {int:limit}',
array('limit' => $topPoster)
);
$users = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$users[] = array(
'id' => $row['id_member'],
'name' => $row['real_name'],
'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'posts' => $row['posts'],
'show' => $row['show_online'],
);
}
$smcFunc['db_free_result']($request);
// Output our array of users with avatar, posts, and name
echo '
<table cellpadding="0" cellspacing="8">';
foreach ($users as $user)
{
echo '
<tr>
<td><h5 style="margin: 4px;">'.$user['link'].'</h5><h5 style="margin: 4px;">'. $user['posts'] .'</h5></td>
</tr>';
}
echo '
</table>';
Quote from: darkangel on May 27, 2012, 12:19:38 AM
This line?
<td><h5 style="margin: 4px;">'.$user['link'].'</h5><h5 style="margin: 4px;">'. $user['posts'] .'</h5></td>
</tr>';
Do I make it like this for inline:
<td><h5 style="margin: 4px;">'.$user['link'] . $user['posts'] .'</h5></td>
</tr>';
something like that?
I don't know did you try it? :D
As for your code, still looks ok to me. Using the code on my test install I can't produce the error like you are. Something weird with your setup, who knows at this point.
well was waiting to see if it was looking right but just did try it...does go inline but I need a space between name and post count....actually about20px maybe? and that I have no clue how to do in php
darn computer posted...lol
anyway I would like to have the post count to the right of the name, almost to the right edge of block and no idea how to get that ac complished
You don't have to do it in the PHP. You do it in the HTML parts. Separate anything else like you wouldn't in HTML. Put some padding in a tag around the parts you need, or put some &nbps in there.
well not sure exactly how but will give it a go. ty
Or you could just add in a second table cell into the row, sort of like this ...
{
echo '
<tr>
<td><h5 style="margin: 4px;">'.$user['link'].'</h5></td><td><h5 style="margin: 4px;">'. $user['posts'] .'</h5></td>
</tr>';
}
ZarPrime
nope it won't behave for me...course I could be not doing it right...big possibility since I just can't seem to wrap my head about what I need to do. very wimple I am sure and something I have done before also I am sure but brain not functioning.
oh for pity sake...I tried that and it did not work...checking I think I left out a couple of td's
thank you so very much for now it is aligned right and am so very happy. now to go uncross my eyes :2funny:
Very cool. 8) Can we mark this one solved now?
ZarPrime
I hope so, so far the error it popped up earlier seems to be gone, hope it stays away too.
Darn Gremlins!
regards,
maxx