News:

Wondering if this will always be free?  See why free is better.

Main Menu

Different board Icons

Started by memo, March 15, 2004, 08:29:55 AM

Previous topic - Next topic

Goodfella

#140
Hi, in classic theme where i should change the code?

// Show the "Board name      Topics  Posts    Last Post" header.
echo '
<table border="0" width="100%" cellspacing="1" cellpadding="5" class="bordercolor">
<tr class="titlebg">
<td colspan="2">', $txt[20], '</td>
<td width="6%" align="center">', $txt[330], '</td>
<td width="6%" align="center">', $txt[21], '</td>
<td width="22%" align="center">', $txt[22], '</td>
</tr>';

/* 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 iamge),
and boards. (see below.) */
foreach ($context['categories'] as $category)
{
// Show the category's name, and let them collapse it... if they feel like it.
echo '
<tr>
<td colspan="5" class="catbg" height="18">';

// 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>';

echo '
', $category['link'], '
</td>
</tr>';

// Only if it's NOT collapsed..
if (!$category['is_collapsed'])
{
/* 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 class="windowbg" width="6%" align="center" valign="top"><img src="', $settings['images_url'], $board['new'] ? '/on.gif" alt="' . $txt[333] . '" title="' . $txt[333] : '/off.gif" alt="' . $txt[334] . '" title="' . $txt[334], '" border="0" /></td>
<td class="windowbg2" align="left" width="60%">
<a name="b', $board['id'], '"></a>
<b>', $board['link'], '</b><br />
', $board['description'];

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

// 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. */
          $childPosts  = 0;
          $childTopics = 0;
          foreach ($board['children'] as $child) {
            $children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
            $childPosts  += $child['posts'];
            $childTopics += $child['topics'];
          }

          echo '
      <i class="smalltext"><br />
      ', $txt['parent_boards'], ': ', implode(', ', $children), '</i>';
        }

        echo '
    </td>
    <td class="windowbg" valign="middle" align="center" width="6%">', $board['topics'] + $childTopics, '</td>
    <td class="windowbg" valign="middle" align="center" width="6%">', $board['posts'] + $childPosts, '</td>';

/* 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.) */
echo '
<td class="windowbg2" valign="middle" width="22%">
<span class="smalltext">
', $board['last_post']['time'], '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
', $txt[525], ' ', $board['last_post']['member']['link'], '
</span>
</td>
</tr>';
}
}
}

// Show the "New Posts" and "No New Posts" legend.
if ($context['user']['is_logged'])
{
echo '
<tr class="titlebg">
<td colspan="2" align="left">
<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new_some.gif" alt="' . $txt[333] . '" border="0" />&nbsp;&nbsp;<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new_none.gif" alt="' . $txt[334] . '" border="0" />
</td>
<td colspan="3" align="right" class="smalltext">';
// Show the mark all as read button?
if ($settings['show_mark_read'])
echo '
<a href="', $scripturl, '?action=markasread;sa=all">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/markread.gif" alt="' . $txt[452] . '" border="0" />' : $txt[452]), '</a>';
echo '
</td>
</tr>';
}

Brain916

Ok, I am using the code at the begining, but have no idea...it will come up just text and no image.

Gary

You need to upload the image to right location. eg. on4.gif (for the board ID of 4 with new posts)

-AwwLilMaggie
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

Goodfella

No code modification, only image names??

Kindred

of course you need to make code modifications.

by default, the code calls for on.gif, on2.gif and off.gif.
the code, as suggested above (not at the beginning, look for one of my more recent posts) uses on_#.gif, on2_#.gif and off_#.gif (where # is the number of the 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."

Goodfella

#145
I have made this changes but return "Template Parse Error!
There was a problem loading the /Themes/classic/BoardIndex.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly."

Original
/* 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 class="windowbg" width="6%" align="center" valign="top"><img src="', $settings['images_url'], $board['new'] ? '/on.gif" alt="' . $txt[333] . '" title="' . $txt[333] : '/off.gif" alt="' . $txt[334] . '" title="' . $txt[334], '" border="0" /></td>
<td class="windowbg2" align="left" width="60%">
<a name="b', $board['id'], '"></a>
<b>', $board['link'], '</b><br />
', $board['description'];


Modified
/* 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 class="windowbg" width="6%" align="center" valign="top"><img src="', $settings['images_url'], '/on_' . $board['id'] . '.gif" alt="', $txt[333], '" title="', $txt[333] : '/off_' . $board['id'] . '.gif" alt="', . $txt[334] . '" title="' . $txt[334], '" border="0" /></td>
<td class="windowbg2" align="left" width="60%">
<a name="b', $board['id'], '"></a>
<b>', $board['link'], '</b><br />
', $board['description'];


Can you tell me whats wrong??

Thx

Kindred




<td class="windowbg" width="6%" align="center" valign="top"><img src="', $settings['images_url'], $board['new'] ? '/on_' . $board['id'] . '.gif" alt="' . $txt[333] . '" title="' . $txt[333] : '/off_' . $board['id'] . '.gif" alt="' . $txt[334] . '" title="' . $txt[334], '" border="0" /></td>


Сл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."

Goodfella

Thank you very much.


Its nice now

VegasBoxers

Has anyone figured out how to make child boards have their own different unique icons yet?

Thanks!
VB

Gary

You do the same thing, but you do it in MessageIndex.template.php instead of BoardIndex.template.php.

-AwwLilMaggie
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

VegasBoxers

Quote from: AwwLilMaggie on October 19, 2006, 08:09:30 PM
You do the same thing, but you do it in MessageIndex.template.php instead of BoardIndex.template.php.

-AwwLilMaggie

Doing this will allow your child boards to have their own unique icons?

VB

Gary

Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

VegasBoxers

Quote from: AwwLilMaggie on October 19, 2006, 09:16:21 PM
Yup.

-AwwLilMaggie

AWW!!!  NOW YOU TELL ME!!! ;D 

I could have used your expertise a while ago when I first launched my SMF!

Thank you!  I still may do this!

VB

Bigguy

I have packaged this code up and uploaded it to the mod site and you can also find it on my site to in the "SMF Helper Released Packages" board on the forum. Hope this helps a bit.

Assistance

~playing poker~

Bigguy

Your very welcome. It has not been approved yet by the mod team but has been tested on SMF 1.1 RC2 and RC3 and installs, uninstalls fine.

Neol

I don't need different icons for each board, but only for each category, something like the docs site of the SMF ( http://docs.simplemachines.org/ ). Any code for this thing?

pinoy123

smf 1.1

help with this one. i edited this boardindex.template at the default and upload my images but the icons doesnt seems to attached at the right board (check the image link)

http://img465.imageshack.us/img465/9246/untitled1my0.jpg


why??? anyone???

Kindred

because you have child boards.

on.gif is for new posts in the title board.
on2.gif is for new posts in a child board under the title board.
off.gif is for no new posts in either the main board or the child board(s).

So, if you wer eusing my version of the code, you would need to upload:
on_###.gif
on2_###.gif
off_###.gif
for each of the main boards (in your case 117, 81, and 87)
Сл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."

Bigguy

I don't want to interupt this conversation at all. I just wanted to say that there has been a new version of cbi (custom board icons) uploaded to the mod site. it now handles child boards and is compatible with SMF 1.1 Final.

http://mods.simplemachines.org/index.php?mod=511

Advertisement: