Author Topic: Custom Board Icon Script  (Read 861 times)

0 Members and 1 Guest are viewing this topic.

Offline pvcblue

  • New Member
  • *
  • Posts: 9
  • Karma: 1
    • Smurfy Forum, Smurfs Forum, Smurf Forum
  • SMF Version: 2.0 RC3
Custom Board Icon Script
« on: April 21, 2010, 06:29:11 PM »
I am working on updating forum to SMF 2.0 RC3 but there is one hitch holding me back now, I cannot do custom board icons in the forum. I have tried the MOD but it cannot be installed - EVERYTHING about it fails!!( on a fresh install without any MODS or hacking)
I had found a while back a hack you could do to the baord.index.template to do this, but with all the new changes I cannot get the code to work with the new board.index.template correctly without losing some look or features. Could someone do this?
Here is the section from my "old" board.index.template from 1.1.11
:

   /* 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" width="6%" align="center" valign="top"><a href="', $scripturl, '?action=unread;board=', $board['id'], '.0">';
 // Individual board icons. If a custom image exists, use it. Otherwise use the default image.
     if (file_exists($settings['theme_dir'] . '/images/on_' . $board['id'] . '.gif'))
      $board_new_img=$settings['images_url']. '/on_' . $board['id'] . '.gif';
     else
      $board_new_img=$settings['images_url']. '/on.gif';
     if (file_exists($settings['theme_dir'] . '/images/on2_' . $board['id'] . '.gif'))
      $childboard_new_img=$settings['images_url']. '/on2_' . $board['id'] . '.gif';
     else
      $childboard_new_img=$settings['images_url']. '/on2.gif';
     if (file_exists($settings['theme_dir'] . '/images/off_' . $board['id'] . '.gif'))
      $board_nonew_img=$settings['images_url']. '/off_' . $board['id'] . '.gif';
     else
      $board_nonew_img=$settings['images_url']. '/off.gif';

               // If the board is new, show a strong indicator.
                 if ($board['new'])
      echo '<img src="', $board_new_img,'" alt="', $txt[333], '" title="', $txt[333], '" border="0" />';
                 // This board doesn't have new posts, but its children do.
                 elseif ($board['children_new'])
      echo '<img src="', $childboard_new_img,'" alt="', $txt[333], '" title="', $txt[333], '" border="0" />';
                    // No new posts at all!  The agony!!
                    else
      echo '<img src="', $board_nonew_img,'" alt="', $txt[334], '" title="', $txt[334], '" border="0" />';
 
    echo '</a>
 
    </td>
 
    <td class="windowbg2">
     <b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
      ', $board['description'];
    echo '
     <br /><span class="smalltext">';
 
    /* 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 '
      <b>', $txt[22], ':</b> ', $board['last_post']['link'], '
      ', $txt[525], ' ', $board['last_post']['member']['link'] , '
      ', $txt[30], ' ', $board['last_post']['time'];
    echo '
     </span>';
    // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
    if (!empty($board['moderators']))
     echo '
     <div style="padding-top: 1px;" class="smalltext"><i>', count($board['moderators']) == 1 ? $txt[298] : $txt[299], ': ', implode(', ', $board['link_moderators']), '</i></div>';
    // Show some basic information about the number of posts, etc.
     echo '
    </td>
    <td class="windowbg" valign="middle" align="center" style="width: 12ex;"><span class="smalltext">
     ', $board['posts'], ' ', $txt[21], ' <br />
     ', $board['topics'],' ', $txt[330], '
    </span></td>
    <td class="windowbg2" valign="middle" width="22%">
     <span class="smalltext">';
    /* 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 '
      <b>', $txt[22], '</b>  ', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
      ', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
      ', $txt[30], ' ', $board['last_post']['time'];
    echo '
     </span>
    </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)
     {
       $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';
       $children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
     }
     echo '
   <tr>
    <td colspan="3" class="windowbg', !empty($settings['seperate_sticky_lock']) ? '3' : '', '">
     <span class="smalltext"><b>', $txt['parent_boards'], '</b>: ', implode(', ', $children), '</span>
    </td>
   </tr>';
    }
   }
   echo '
  </table>';
  }
  echo '
 </div>';
 }
 if ($context['user']['is_logged'])
 {
  echo '
 <table border="0" width="100%" cellspacing="0" cellpadding="5">
  <tr>
   <td align="', !$context['right_to_left'] ? 'left' : 'right', '" class="smalltext">
    <img src="' . $settings['images_url'] . '/new_some.gif" alt="" align="middle" /> ', $txt[333], '
    <img src="' . $settings['images_url'] . '/new_none.gif" alt="" align="middle" style="margin-left: 4ex;" /> ', $txt[334], '
   </td>
   <td align="', !$context['right_to_left'] ? 'right' : 'left', '">';
  // Mark read button.
  $mark_read_button = array('markread' => array('text' => 452, 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;sesc=' . $context['session_id']));
  // Show the mark all as read button?
  if ($settings['show_mark_read'] && !empty($context['categories']))
    echo '
    <table cellpadding="0" cellspacing="0" border="0" style="position: relative; top: -5px;">
     <tr>
        ', template_button_strip($mark_read_button, 'top'), '
     </tr>
    </table>';
  echo '
   </td>
  </tr>
 </table>';
 }
 // Here's where the "Info Center" starts...
 
« Last Edit: April 24, 2010, 09:44:49 AM by bigguy »

"Smurfs, Smurfs, and More Smurfs!"

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Custom Board Icon Script
« Reply #1 on: April 21, 2010, 07:44:12 PM »
I'll look at it when I get home.

Offline pvcblue

  • New Member
  • *
  • Posts: 9
  • Karma: 1
    • Smurfy Forum, Smurfs Forum, Smurf Forum
  • SMF Version: 2.0 RC3
Re: Custom Board Icon Script
« Reply #2 on: April 21, 2010, 09:52:50 PM »
I'll look at it when I get home.

solved,  :ntme
« Last Edit: April 22, 2010, 09:07:47 PM by pvcblue »

"Smurfs, Smurfs, and More Smurfs!"