News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

cbi v0.5 (Custom Board Icons)

Started by Bigguy, November 11, 2006, 11:59:46 AM

Previous topic - Next topic

Neubivljiv

Very nice mod.

1) I have few question. On mousehover over icons I get >info<: "No icon set". Icons works fine, i only see that message on mousehover. Just wonder is that normal or not?

2) What is difference between on.png and on2.png?

Daegaladh

I got an error when trying to install in 1.1.11, please update for this ver.

Kindred

on2.png is used when there are new messages in a child board of the displayed board.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Yahmez

Quote from: Neubivljiv on January 03, 2010, 07:08:17 PM
1) I have few question. On mousehover over icons I get >info<: "No icon set". Icons works fine, i only see that message on mousehover. Just wonder is that normal or not?

See this post to fix that.

jcommander

Can this mod be used with Default Theme - Core 1.1.11 and in Themes\Core 2.0 RC2? Thanks

Kindred

this mod can be used with any theme....   but it may require you to manually code it into boardindex.template.php in your theme
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

jcommander

Thanks Kindred, can you give me a link as to where to learn how to do that, specially with v. 2.0 RC 2 please?

Kindred

look at the manual installation instructions for the mod (link is on the mod download page)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

jcommander

You mean the part with the instructions as to what part to look up and then replace/add it by some other code?

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

jcommander


FFSFFS

Hello, I tried to manually install the codes into my Index Template file, but when I replaced what i was told to replace, my board turned into looking like this: http://www.blizzcraft.net/index.php

the icons appear, but the board is wack.

FFSFFS

#612
this is my code:
function template_main()
{
   global $context, $settings, $options, $txt, $scripturl, $modSettings;

   // Show some statistics if stat info is off.
   if (!$settings['show_stats_index'])
      echo '
   <p id="stats">
      ', $txt['members'], ': ', $context['common_stats']['total_members'], ' &nbsp;&#8226;&nbsp; ', $txt['posts_made'], ': ', $context['common_stats']['total_posts'], ' &nbsp;&#8226;&nbsp; ', $txt['topics'], ': ', $context['common_stats']['total_topics'], '
      ', ($settings['show_latest_member'] ? '<br />' . $txt['welcome_member'] . ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>' . $txt['newest_member'] : '') , '
   </p>';

   // Show the news fader?  (assuming there are things to show...)
   if ($settings['show_newsfader'] && !empty($context['fader_news_lines']))
   {
      echo '
   <div class="tborder marginbottom">
      <h3 id="newsfader" class="catbg">
         <img id="newsupshrink" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="display: none;" />
         ', $txt['news'], '
      </h3>
      <div class="windowbg2" id="smfNewsFader">
         <div id="smfFadeScroller"><span>', $context['news_lines'][0], '</span></div>
      </div>
   </div>
   <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/fader.js"></script>
   <script type="text/javascript"><!-- // --><![CDATA[

      // Create a news fader object.
      var oNewsFader = new smf_NewsFader({
         sSelf: \'oNewsFader\',
         sFaderControlId: \'smfFadeScroller\',
         aFaderItems: [
            "',
            implode('",
            "', $context['fader_news_lines']), '"],
         sItemTemplate: ', JavaScriptEscape('<strong>%1$s</strong>'), ',
         iFadeDelay: ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], '
      });

      // Create the news fader toggle.
      var smfNewsFadeToggle = new smc_Toggle({
         bToggleEnabled: true,
         bCurrentlyCollapsed: ', empty($options['collapse_news_fader']) ? 'false' : 'true', ',
         aSwappableContainers: [
            \'smfNewsFader\'
         ],
         aSwapImages: [
            {
               sId: \'newsupshrink\',
               srcExpanded: smf_images_url + \'/collapse.gif\',
               altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
               srcCollapsed: smf_images_url + \'/expand.gif\',
               altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
            }
         ],
         oThemeOptions: {
            bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
            sOptionName: \'collapse_news_fader\',
            sSessionVar: ', JavaScriptEscape($context['session_var']), ',
            sSessionId: ', JavaScriptEscape($context['session_id']), '
         },
         oCookieOptions: {
            bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
            sCookieName: \'newsupshrink\'
         }
      });
   // ]]></script>';
   }

   /* Each category in categories is made up of:
   id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
   new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
   and boards. (see below.) */
   foreach ($context['categories'] as $category)
   {
      // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
      if (empty($category['boards']) && !$category['is_collapsed'])
         continue;

      echo '
   <div class="categoryframe tborder clearfix">
      <h3 class="catbg', $category['new'] ? '2' : '', '">';

      if (!$context['user']['is_guest'] && !empty($category['show_unread']))
         echo '
         <a class="floatright" href="', $scripturl, '?action=unread;c=', $category['id'], '">', $txt['view_unread_category'], '</a>';

      // If this category even can collapse, show a link to collapse it.
      if ($category['can_collapse'])
         echo '
         <a href="', $category['collapse_href'], '">', $category['collapse_image'], '</a>&nbsp;';

      echo $category['link'];

      echo '
      </h3>';

      // Assuming the category hasn't been collapsed...
      if (!$category['is_collapsed'])
      {
         echo '
      <table cellspacing="1" class="bordercolor boardsframe">';

         /* Each board in each category's boards has:
         new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
         children (see below.), link_children (easier to use.), children_new (are they new?),
         topics (# of), posts (# of), link, href, and last_post. (see below.) */
         foreach ($category['boards'] as $board)
         {
            echo '
         <tr>
            <td', !empty($board['children']) ? ' rowspan="2"' : '', ' class="windowbg icon">
               <a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';

if ($board['new']) {               if (file_exists($settings['theme_dir'] . '/icons/' . $board['id'] . '/on.png'))                  $board_new_img=$settings['theme_url']. '/icons/' . $board['id'] . '/on.png';               else                  $board_new_img=$settings['images_url']. '/on.png';                     echo '<img src="', $board_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';            } elseif ($board['children_new']) {               if (file_exists($settings['theme_dir'] . '/icons/' . $board['id'] . '/on2.png'))                  $childboard_new_img=$settings['theme_url']. '/icons/' . $board['id'] . '/on2.png';               else                  $childboard_new_img=$settings['images_url']. '/on2.png';                        echo '<img src="', $childboard_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';               } else {               if (file_exists($settings['theme_dir'] . '/icons/' . $board['id'] . '/off.png'))                  $board_nonew_img=$settings['theme_url']. '/icons/' . $board['id'] . '/off.png';               else                  $board_nonew_img=$settings['images_url']. '/off.png';                  echo '<img src="', $board_nonew_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';            }            // Is it a redirection board?            if ($board['is_redirect'])               echo '<img src="', $settings['images_url'], '/redirect.png" alt="*" title="*" border="0" />';            echo '</a>            </td>            <td class="windowbg2 info">               <b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b>';

            // Has it outstanding posts for approval?
            if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
               echo '
                  <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > $board['unapproved_posts'] ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>';

            echo '
               </h4>
               <p>', $board['description'] , '</p>';

            // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
            if (!empty($board['moderators']))
               echo '
               <p class="moderators">', count($board['moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';

            // Show some basic information about the number of posts, etc.
               echo '
            </td>
            <td', !empty($board['children']) ? ' rowspan="2"' : '', ' class="windowbg stats smalltext">
               ', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
               ', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
            </td>
            <td', !empty($board['children']) ? ' rowspan="2"' : '', ' class="windowbg2 smalltext lastpost">';

            /* The board's and children's 'last_post's have:
            time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
            link, href, subject, start (where they should go for the first unread post.),
            and member. (which has id, name, link, href, username in it.) */
            if (!empty($board['last_post']['id']))
               echo '
               <strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
               ', $txt['in'], ' ', $board['last_post']['link'], '<br />
               ', $txt['on'], ' ', $board['last_post']['time'];
            echo '
            </td>
         </tr>';

            // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
            if (!empty($board['children']))
            {
               // Sort the links into an array with new boards bold so it can be imploded.
               $children = array();
               /* Each child in each board's children has:
                     id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
               foreach ($board['children'] as $child)
               {
                  if (!$child['is_redirect'])
                     $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
                  else
                     $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';

                  // Has it posts awaiting approval?
                  if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
                     $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > $child['unapproved_posts'] ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';

                  $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
               }
               echo '
         <tr>
            <td class="windowbg3 smalltext largepadding"><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</td>
         </tr>';
            }
         }
         echo '
      </table>';
      }
      echo '
   </div>';
   }

   if ($context['user']['is_logged'])
   {
      echo '
   <div id="modbuttons_bottom" class="modbuttons clearfix">
      <div id="posticons" class="clearfix marginbottom">
         <div class="smalltext floatleft">
            <img src="', $settings['images_url'], '/new_some.gif" alt="" align="middle" /> ', $txt['new_posts'], '
            <img src="', $settings['images_url'], '/new_none.gif" alt="" align="middle" style="margin-left: 4ex;" /> ', $txt['old_posts'], '
         </div>';

         // Mark read button.
         $mark_read_button = array(
            'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
         );

         // Show the mark all as read button?
         if ($settings['show_mark_read'] && !empty($context['categories']))
            template_button_strip($mark_read_button, 'top');

         echo '
         </div>
   </div>';
   }

   template_info_center();
}


edit - please use CODE tags instead of quote tags

Bigguy

We can only see a login screen. What version are you using and why are you modifying the index.template. ???

jcommander

Hey, Bigguy! this mod is working very good with my smf version (1.1.11) Thanks for sharing this. :)

FFSFFS

when I installed it, it wouldn't install onto my BlackRain theme - I'm using 2.0RC2 - so I try to add it to my template manually.

Bigguy

Parse the code on the mod download page and add the code where it says to. Not in the index.template.

Arkino

#617
Hello there.

I need some help.

I have a new Forum. It does not have any mod installed.

When I tried to install I had 2 errors.

1.     Executar Modificación     ./Themes/default/BoardIndex.template.php     Prueba fallida
2.    Executar Modificación    ./Themes/default/MessageIndex.template.php    Prueba fallida
3.    Executar Modificación    ./Themes/default/languages/Modifications.english.php    Éxito

what place I have to edit for it work on 1.1.11?

./Themes/default/BoardIndex.template.php

Find:

// If the board is new, show a strong indicator.
if ($board['new'])
echo '<img src="', $settings['images_url'], '/on.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
// This board doesn't have new posts, but its children do.
elseif ($board['children_new'])
echo '<img src="', $settings['images_url'], '/on2.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
// No new posts at all! The agony!!
else
echo '<img src="', $settings['images_url'], '/off.gif" alt="', $txt[334], '" title="', $txt[334], '" />';

echo '</a>
</td>
<td class="windowbg2"', $board['is_redirect'] && $modSettings['redirect_hide_columns'] ? ' colspan="2"' : '' , '>
<b><a href="', $board['href'], '" name="b', $board['id'], '"', ($board['is_redirect'] && $board['redirect_target'] != '') ? ' target="' . $board['redirect_target'] . '"' : '' , '>', $board['name'], '</a></b><br />
', $board['description'];


Replace With:

if ($board['new']) {
if (file_exists($settings['theme_dir'] . '/icons/' . $board['id'] . '/on.png'))
$board_new_img=$settings['theme_url']. '/icons/' . $board['id'] . '/on.png';
else
$board_new_img=$settings['images_url']. '/on.png';

echo '<img src="', $board_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
} elseif ($board['children_new']) {
if (file_exists($settings['theme_dir'] . '/icons/' . $board['id'] . '/on2.png'))
$childboard_new_img=$settings['theme_url']. '/icons/' . $board['id'] . '/on2.png';
else
$childboard_new_img=$settings['images_url']. '/on2.png';

echo '<img src="', $childboard_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
} else {
if (file_exists($settings['theme_dir'] . '/icons/' . $board['id'] . '/off.png'))
$board_nonew_img=$settings['theme_url']. '/icons/' . $board['id'] . '/off.png';
else
$board_nonew_img=$settings['images_url']. '/off.png';

echo '<img src="', $board_nonew_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
}
// Is it a redirection board?
if ($board['is_redirect'])
echo '<img src="', $settings['images_url'], '/redirect.png" alt="*" title="*" border="0" />';


echo '</a>
</td>
<td class="windowbg2 info">
               <b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b>';


and

./Themes/default/MessageIndex.template.php

Find:

// If the board is new, show a strong indicator.
if ($board['new'])
echo '<img src="', $settings['images_url'], '/on.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
// This board doesn't have new posts, but its children do.
elseif ($board['children_new'])
echo '<img src="', $settings['images_url'], '/on2.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
// No new posts at all! The agony!!
else
echo '<img src="', $settings['images_url'], '/off.gif" alt="', $txt[334], '" title="', $txt[334], '" />';

echo '</a>
</td>
<td class="windowbg2"', $board['is_redirect'] && $modSettings['redirect_hide_columns'] ? ' colspan="2"' : '', '>
<b><a href="', $board['href'], '" name="b', $board['id'], '"', ($board['is_redirect'] && $board['redirect_target'] != '') ? ' target="' . $board['redirect_target'] . '"' : '' , '>', $board['name'], '</a></b><br />
', $board['description'];


Remplace with:

if ($board['new']) {
if (file_exists($settings['theme_dir'] . '/icons/' . $board['id'] . '/on.png'))
$board_new_img=$settings['theme_url']. '/icons/' . $board['id'] . '/on.png';
else
$board_new_img=$settings['images_url']. '/on.png';

echo '<img src="', $board_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
} elseif ($board['children_new']) {
if (file_exists($settings['theme_dir'] . '/icons/' . $board['id'] . '/on2.png'))
$childboard_new_img=$settings['theme_url']. '/icons/' . $board['id'] . '/on2.png';
else
$childboard_new_img=$settings['images_url']. '/on2.png';

echo '<img src="', $childboard_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
} else {
if (file_exists($settings['theme_dir'] . '/icons/' . $board['id'] . '/off.png'))
$board_nonew_img=$settings['theme_url']. '/icons/' . $board['id'] . '/off.png';
else
$board_nonew_img=$settings['images_url']. '/off.png';

echo '<img src="', $board_nonew_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
}
// Is it a redirection board?
if ($board['is_redirect'])
echo '<img src="', $settings['images_url'], '/redirect.png" alt="*" title="*" border="0" />';


echo '</a>
</td>
<td class="windowbg2">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b>';


is it correct?

Bigguy

Yes those look like the edits for the most recent version of the mod.

Arkino

#619
I did it but I have an error. Forums does not display description at boards :S

thanks in advance

Advertisement: