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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 142
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 80
  • Total: 80

Help needed with Legend Mod + Possible legend block

Started by knat, November 19, 2006, 10:30:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knat

Now i know that this MOD comes from SMF but i dont want to wait days and days to get a reply so im trying here.

I have installed the Legend Mod but it only shows Groups and i cant get it to show post-count-groups.. this is the modification it makes to my boardindex.template.php

- <file name="$themedir/BoardIndex.template.php" error="fatal">
- <operation error="fatal">
- <search position="replace" regexp="false" whitespace="exact">
- <![CDATA[ <td rowspan="2" class="windowbg" width="20" valign="middle" align="center">
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', '<img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt[158], '" />', $context['show_who'] ? '</a>' : '', '

  ]]>
  </search>
- <add>
- <![CDATA[ <td rowspan="3" class="windowbg" width="20" valign="middle" align="center">
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', '<img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt[158], '" />', $context['show_who'] ? '</a>' : '', '

  ]]>
  </add>
  </operation>
- <operation error="fatal">
- <search position="replace" regexp="false" whitespace="exact">
- <![CDATA[ echo '
<br />
', $context['show_stats'] && !$settings['show_sp1_info'] ? '<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>
</td>
</tr>

  ]]>
  </search>
- <add>
- <![CDATA[ echo '
<br />
', $context['show_stats'] && !$settings['show_sp1_info'] ? '<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>
</td>
</tr>';
         if ($modSettings['enableMCL'])
            {
            echo '
            <tr>
               <td class="windowbg2" width="100%">
                  <span class="middletext">';
                    if(!empty($context['online_groups']) && !empty($modSettings['defaultMCLtext']))
                        echo $modSettings['defaultMCLtext']. '&nbsp;-&nbsp;';
                foreach($context['online_groups'] AS $group)
                {
                    if(!empty($group['color']) && $group['color'] != '')
                            echo '[<span style="color:' . $group['color'] . '">' . $group['name'] . '</span>] ';
                }
                  echo '</span>
               </td>
            </tr>';
            }
            echo '

  ]]>
  </add>


Any of you php gurus who can help me out.. i need it to show all groups in the legend..

Ohh and another thing.. is there any way to add this under the online block i have on my frontpage.. just with linebreaks.. and small text ?

Anyway i would be happy if any could help me out or point me in the right direction

EDIT: I found out that it is only the newbee group that is not showing (post count: 0) [See attached image]

Why is it not showing that group... very strange  :o


2nd EDIT: I Figured it out.. the membergroup must have a colour to show... the newbie group didnt have a colour and therefor did not show.. But i still would love to have this to show in small text under my TP online block.. possible ?


knat

Ok i went to photoshop and made an example of what i would love to have.. check out thew attached image  :D

Techdomain

In your Themes/default, you will find TPortalBlocks.template.php, which contains this code:


// TPortal stats box

function TPortal_statsbox()

{

       global $context, $settings, $options, $scripturl, $txt, $modSettings;



$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

        echo'<table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>';

        echo '<td width="100%" valign="top" class="smalltext" style="font-family: verdana, arial, sans-serif;">';



       if(isset($context['TPortal']['userbox']['stats']))

   // members stats

            echo '

                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />

                 <a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>

                 <br />'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '

                 <br />'.$bullet.$txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';

       if(isset($context['TPortal']['userbox']['stats_all']))

   // more stats

            echo '

                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />

                 <a href="'.$scripturl.'?action=stats"><b>'.$txt['tp-stats'].'</b></a>

                 <br />'.$bullet.$txt[489].': '.$modSettings['totalMessages']. '

  <br />'.$bullet. $txt[490].': '.$modSettings['totalTopics']. '

  <br />'.$bullet.$txt['tp-mostonline-today'].': '.$modSettings['mostOnlineToday'].'

  <br />'.$bullet.$txt['tp-mostonline'].': '.$modSettings['mostOnline'].'<br />

  ('.timeformat($modSettings['mostDate']).')

  ';



       if(isset($context['TPortal']['userbox']['online'])){

   // add online users

            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />

                 <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';



            $online = ssi_whosOnline('array');

   echo $bullet.$txt['tp-users'].': '.$online['num_users'];

   echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];

   echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />

<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';



      foreach($online['users'] as $user){

echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];

echo '<br />';

   }

echo '</div>';

         }

echo '<br /></td></tr></table>';

}

(or similar - I might have changed that at some stage)

You can probably meld the code a little... I will have a go at it if you like even.
If you cant do it yourself, post a link to the mod, and I willhave a go at it on my test site.

knat

Link to MOD: http://www.simplemachines.org/community/index.php?topic=53182.0

Im really really bad at this php stuff.. so any help would be truely apreciated  :)

Techdomain

Try this file (unzip it and upload it to /Themes/default) be sure to backup your original first though!
I have no idea if it will work... but it didnt break my site (I dont have the mod installed. It might be a good starting point. (might not also - I am not the worlds best PHP expert)

knat

since my file is modified with a few mods... felblog being one of them i couldnt just use your file.. so i tried to figure out what you did and i came to the result that this is the code that needs to be added to the userbox

         if ($modSettings['enableMCL']){
           
           //add legends
         
            echo '
            <tr>
               <td>';
                    if(!empty($context['online_groups']) && !empty($modSettings['defaultMCLtext']))
                        echo $modSettings['defaultMCLtext']. '&nbsp;-&nbsp;';
                foreach($context['online_groups'] AS $group)
                {
                    if(!empty($group['color']) && $group['color'] != '')
                            echo '[<span style="color:' . $group['color'] . '">' . $group['name'] . '</span>] ';
                }
                  echo '</span>
               </td>
            </tr>';
            }


But sadly nothing happens when i put this code in there.. nothing at all  :P


Techdomain

lol - um ok... maybe time for one of the proper coders to take a look then!

This website is proudly hosted on Crocweb Cloud Website Hosting.