Topic: Mini Portal and top posters

Well, I want to add the top posters to the sidebar in Connorhd's miniportal.  I've even searched these forums a few times, but I'm still clueless on how to do it.

Any pointers?

2

Re: Mini Portal and top posters

try this

3 (edited by farooq 2006-01-16 01:12)

Re: Mini Portal and top posters

k...

I've added this to the bottom of the functions.php:

function top_posters()
{
    global $pun_config, $lang_common, $pun_user, $db;
    $result = $db->query('SELECT id, username, num_posts FROM '.$db->prefix.'users ORDER BY num_posts DESC LIMIT 10') or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
    while ($data = $db->fetch_assoc($result))
       {
          echo "<ul><li>\t\t\t\t\t\t".'<a href="profile.php?id='.$data['id'].'">'.pun_htmlspecialchars($data['username']).'</a> ('.$data['num_posts'].') '."\n</li></ul>";
       }
}

And the following to header.php:

// START SUBST - <pun_top_posters>
$tpl_main = str_replace('<pun_top_posters>', '<div class="inbox">'."\n\t\t\t". top_posters()."\n\t\t".'</div>', $tpl_main);
//END SUBST - <pun_top_posters>

With the appropriate editing of the main.tpl.   However, because the function is called in the header, it is being printed there, not in the right spot.

I've looked into changing the function to return instead of echo.  However, it will only return one line of the top posters function..   

Any clue on how to make this an array that will be printed in the appropriate place on the page?

Re: Mini Portal and top posters

Anyone with any help?

Or perhaps another suggestion on how to accomplish this?

Much appreciated! smile

Re: Mini Portal and top posters

Try putting it on footer.php and just replace echo by return and it should work.

Re: Mini Portal and top posters

But, I want it to follow the rest of the miniportal, so that I can include it in the main.tpl, and move it around, and use themes to change it's looks..

Re: Mini Portal and top posters

Nothing?

Re: Mini Portal and top posters

http://www.punres.org/files.php?pid=78
this is a mini protal that someone modified
i use it on http://nalan.org
it has the top posters and a few good mods in it
Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Mini Portal and top posters

I've finally figured it out, and have updated the miniportal wiki over at punres to include this tidbit.

Thanks for the help smile