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: 378
  • Total: 378

Poster cloud

Started by JPDeni, August 04, 2006, 05:51:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

akulion

hi jp

in this post:
http://www.tinyportal.net/smf/index.php?topic=6996.msg61853#msg61853

the code u gave made everyone elses names REALLY small lol

so i changed it to this


  $fsize = $count[$value];
if ($fsize > 28)
  $fsize = 28;
elseif ($fsize < 28)
  $fsize = $count[$value] + 7;


it seems to work fine for now but I just wanted your input on 'long term ramifications' of this? would it effect anything ?

JPDeni

Go with what works. You can always change it.

I had intended it to be on a side block, so names that are too large will really mess up the balance of your site. You have yours in a center block, so it's not that much of a problem.

knat

This is a nice script.. is there anyway to make it show the colors of the membergroups ?

JPDeni

Probably, but I don't have different colors for my membergroups, so there's no way for me to test it. And I guess I had too much turkey yesterday because I can't seem to write anything this morning that works. :)

JPDeni

Okay. I think this works. At least I don't get any errors.


global $db_prefix, $scripturl;
$nbsp = "&n"."bsp;";
$count= array();
$poster_number = array();
$query = db_query(
    "SELECT mes.posterName, mes.ID_MEMBER, mem.ID_GROUP, grp.onlineColor
     FROM smf_messages as mes
     LEFT JOIN smf_members as mem
     ON mem.ID_MEMBER = mes.ID_MEMBER
     LEFT JOIN smf_membergroups as grp
     ON grp.ID_GROUP = mem.ID_GROUP
     WHERE mem.ID_GROUP <> 1 AND mem.ID_GROUP <> 2
     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']];
    $poster_number[$row['posterName']] = $row['ID_MEMBER'];
    $poster_color[$row['posterName']] = $row['onlineColor'];
}

asort($count);
$low_count = reset($count);

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = intval($count[$value]/$low_count) + 7;
  if ($fsize > 20)
    $fsize = 20;
  elseif ($fsize < 8)
    $fsize = 8;
  $name = str_replace(" ",$nbsp,$value);
  if (!empty($poster_color[$value]))
    echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
    '" style="font-size:' . $fsize . 'pt; color:' . $poster_color[$value] . '">ÂÃ,·' . $name . 'ÂÃ,·</a> ';
  else
    echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
    '" style="font-size:' . $fsize . 'pt;">ÂÃ,·' . $name . 'ÂÃ,·</a> ';
}
echo '</div>';

knat

It worked .. thanks.. but it dont show the colors of post-count-based-groups for some reason.. any way to fix that ?  :)

BTW i envy you on all that turkey you ate.. we dont have that tradition here in Denmark  ::)

JPDeni

#66
Quoteit dont show the colors of post-count-based-groups for some reason
That's because you didn't ask for it. :)

change

ON grp.ID_GROUP = mem.ID_GROUP


to


ON grp.ID_GROUP = mem.ID_POST_GROUP


QuoteBTW i envy you on all that turkey you ate.. we dont have that tradition here in Denmark 
But you have turkey, right? You can still eat it, even if you don't have the tradition. :)

knat

That little change made all the names disappear  :o

Yes we have Turkey but its not something that we normaly eat.. But sometimes my parrents makes it for christmas.. so i know that it taste real good..  ::)

JPDeni

#68
Then I guess you should put it back the way it was. :-)

I'll work with it a bit and see if I can figure out how to do what you want.

Edited to add--

It works within the database just fine. But I can't test it any further because I don't use colors for member groups.

knat

No problemo.. it looks great still.. thanks for helping me out  ;)

This website is proudly hosted on Crocweb Cloud Website Hosting.