Advertisement:

Author Topic: Different board Icons  (Read 266380 times)

Offline haup9

  • Semi-Newbie
  • *
  • Posts: 17
  • Gender: Male
  • I love fish!!!
    • Fish2Friends
Re: Different board Icons
« Reply #20 on: October 01, 2004, 07:44:39 PM »
I have it working! Thanks for all the help. ;D
[nofollow]

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Different board Icons
« Reply #21 on: October 02, 2004, 05:16:18 AM »
I have it working! Thanks for all the help. ;D

Good job. :)
Cristián Lávaque http://cristianlavaque.com

Offline Midgard

  • Jr. Member
  • **
  • Posts: 271
  • Gender: Male
Re: Different board Icons
« Reply #22 on: December 25, 2004, 12:41:07 PM »

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: Different board Icons
« Reply #23 on: December 27, 2004, 12:31:47 AM »
sorry fo goin bak to this old topic but i would like to kno if there is a way so that if no image is set  for a board it select the default on/off images?  also have 2or more board with the name image w/o having to set a diff id. thanks in advance
« Last Edit: December 27, 2004, 12:40:20 AM by LiL_J »
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Different board Icons
« Reply #24 on: December 27, 2004, 05:45:43 AM »
It would be complicated to do that, I'm afraid.  Almost makes more sense, in that case, to add a column to the boards table.

-[Unknown]

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Different board Icons
« Reply #25 on: December 27, 2004, 12:55:23 PM »
Well, if he still wants it hardcoded, which all this tip is anyway, he could have this array right before the foreach

Code: [Select]
// Boards with custom icon: board ID => true.
$icons = array(
1 => true,
5 => true,
);

Then at the beginning of the foreach add this

Code: [Select]
$board['icon'] = isset($icons[$board['id']]) ? $board['id'] : '';

And then in the img tags, instead of using $board['id'], use $board['icon'], ie

Code: [Select]
"', $settings['images_url'], '/on', $board['icon'], '.gif"
Cristián Lávaque http://cristianlavaque.com

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Different board Icons
« Reply #26 on: December 27, 2004, 01:01:29 PM »
Just read that you may want to use the same image for more than one board, then you could do it like this

Code: [Select]
// Boards with custom icon: board ID => icon's suffix.
$icons = array(
1 => '1',
5 => '1',
);

Code: [Select]
$board['icon'] = isset($icons[$board['id']]) ? $icons[$board['id']] : '';
Cristián Lávaque http://cristianlavaque.com

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: Different board Icons
« Reply #27 on: December 27, 2004, 03:00:28 PM »
THIS IS WHAT I HAVE NOT SURE IF ITS CORRECT

Code: [Select]
/* 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.) */
// Boards with custom icon: board ID => icon's suffix.
$icons = array(
1 => '1',
5 => '1',
);
$board['icon'] = isset($icons[$board['id']]) ? $icons[$board['id']] : '';
foreach ($category['boards'] as $board)
{
echo '
<tr class="windowbg2">
<td class="windowbg" width="6%" align="center" valign="top">';

// If the board is new, show a strong indicator.
if ($board['new'])
echo '<img src="', $settings['images_url'], '/custom/on_', $board['id'], '.gif" 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="', $settings['images_url'], '/custom/on2_', $board['id'], '.gif" alt="', $txt[333], '" title="', $txt[333], '" border="0" />';
// No new posts at all!  The agony!!
else
echo '<img src="', $settings['images_url'], '/custom/off_', $board['id'], '.gif" alt="', $txt[334], '" title="', $txt[334], '" border="0" />';

« Last Edit: December 27, 2004, 03:03:32 PM by LiL_J »
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Different board Icons
« Reply #28 on: December 27, 2004, 09:07:52 PM »
The line

Code: [Select]
$board['icon'] = isset($icons[$board['id']]) ? $icons[$board['id']] : '';
goes at the beginning of the foreach, not before. I'll write it clearer in a moment...
Cristián Lávaque http://cristianlavaque.com

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Different board Icons
« Reply #29 on: December 27, 2004, 09:22:46 PM »
Code: [Select]
<search for>
foreach ($category['boards'] as $board)
{
echo '
<tr class="windowbg2">
<td class="windowbg" width="6%" align="center" valign="top">';

// 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], '" border="0" />';
// 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], '" border="0" />';
// No new posts at all!  The agony!!
else
echo '<img src="', $settings['images_url'], '/off.gif" alt="', $txt[334], '" title="', $txt[334], '" border="0" />';
</search for>

<replace>
// Boards with custom icons.
$icons = array(
1 => '1',
2 => '2',
5 => '1',
);

foreach ($category['boards'] as $board)
{
$board['icon'] = isset($icons[$board['id']]) ? '_' . $icons[$board['id']] : '';

echo '
<tr class="windowbg2">
<td class="windowbg" width="6%" align="center" valign="top">';

// If the board is new, show a strong indicator.
if ($board['new'])
echo '<img src="', $settings['images_url'], '/on' . $board['icon'] . '.gif" 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="', $settings['images_url'], '/on2' . $board['icon'] . '.gif" alt="', $txt[333], '" title="', $txt[333], '" border="0" />';
// No new posts at all!  The agony!!
else
echo '<img src="', $settings['images_url'], '/off' . $board['icon'] . '.gif" alt="', $txt[334], '" title="', $txt[334], '" border="0" />';
</replace>

In icons array you use the board's ID for key and the icon's suffix for value. The boards that aren't added to the array, will use the default icons. If you use the same value for more than one board, they'll share the custom icon.

In the images dir where you have on.gif, on2.gif and off.gif, you add the custom icons with the suffixes used in the $icons array, ie: on_1.gif, on2_1.gif, off_1.gif.
Cristián Lávaque http://cristianlavaque.com

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: Different board Icons
« Reply #30 on: December 27, 2004, 11:21:32 PM »
sup bro worked like a charm.  take a look at it http://kevmundial.com/board  ;) ;) :)
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Different board Icons
« Reply #31 on: December 28, 2004, 12:31:08 AM »
sup bro worked like a charm.  take a look at it http://kevmundial.com/board ;) ;) :)

Glad it worked. :)

I may give it an admin setting and package it someday...
Cristián Lávaque http://cristianlavaque.com

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: Different board Icons
« Reply #32 on: December 28, 2004, 11:58:50 AM »
I may give it an admin setting and package it someday...
that would b great
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline trenchteam

  • Sr. Member
  • ****
  • Posts: 901
  • Gender: Male
    • NO WALLS STANDING
Re: Different board Icons
« Reply #33 on: January 01, 2005, 09:18:09 PM »
That would be awesomE!

Offline homeslice

  • Jr. Member
  • **
  • Posts: 183
  • Gender: Male
  • Usin' braincells as dippin' sauce
    • Wordabuse
Re: Different board Icons
« Reply #34 on: January 19, 2005, 01:06:33 AM »
Could u give more detail to this explanation of making topic images, its confusing,

Quote
Code:
// If the board is new, show a strong indicator.
   if ($board['new'])
   echo '<img src="', $settings['images_url'], '/on', $board['id'], '.gif" 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="', $settings['images_url'], '/on2', $board['id'], '.gif" alt="', $txt[333], '" title="', $txt[333], '" border="0" />';
// No new posts at all!  The agony!!
   else
   echo '<img src="', $settings['images_url'], '/off', $board['id'], '.gif" alt="', $txt[334], '" title="', $txt[334], '" border="0" />';

  echo '</td>
 
 
 

So type a bunch of board image files for each image ? Explan what u mean Im lost sorry

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


Offline homeslice

  • Jr. Member
  • **
  • Posts: 183
  • Gender: Male
  • Usin' braincells as dippin' sauce
    • Wordabuse
Re: Different board Icons
« Reply #35 on: January 19, 2005, 10:30:36 AM »
Im getting frustrated  >:( with this I tried alot of times to use the code and I cant get it,

This is what I've been doing, I have 24 seperate forums in 5 categories, I want different icons for all 24 boards, 1 on & one off icon for each 24 forums. Ok, Now I go to :

Code: [Select]
// If the board is new, show a strong indicator.
   if ($board['new'])
   echo '<img src="', $settings['images_url'], '/on', $board['id'], '.gif" 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="', $settings['images_url'], '/on2', $board['id'], '.gif" alt="', $txt[333], '" title="', $txt[333], '" border="0" />';
// No new posts at all!  The agony!!
   else
   echo '<img src="', $settings['images_url'], '/off', $board['id'], '.gif" alt="', $txt[334], '" title="', $txt[334], '" border="0" />';

  echo '</td>

Than I tried to do this...

Code: [Select]
// If the board is new, show a strong indicator.
   if ($board['new'])
   echo '<img src="', $settings['images_url'], '/on', $board['13'], 'ontextbattle.gif" 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="', $settings['images_url'], '/on2', $board['13'], 'on2textbattle.gif" alt="', $txt[333], '" title="', $txt[333], '" border="0" />';
// No new posts at all!  The agony!!
   else
   echo '<img src="', $settings['images_url'], '/off', $board['13'], 'offtextbattle.gif" alt="', $txt[334], '" title="', $txt[334], '" border="0" />';

  echo '</td>

Ok so that does the Textbattle forum, Now I have 23 other forums, how do I add each one with different images ? And also.... was that done properly ?

I dont get what Im doing  :'(

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


Offline homeslice

  • Jr. Member
  • **
  • Posts: 183
  • Gender: Male
  • Usin' braincells as dippin' sauce
    • Wordabuse
Re: Different board Icons
« Reply #36 on: January 20, 2005, 12:40:20 AM »
Just basically tell me how to put each board id and each picture url thing in order so I dont get an error message like I usually do when I do it myself

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Different board Icons
« Reply #37 on: January 20, 2005, 01:38:31 AM »
So type a bunch of board image files for each image ? Explan what u mean Im lost sorry

The first one ($board['id']) was correct.  You just have to create files in the images directory:

on##.gif
on2##.gif
off##.gif

Where ## is the id; for example, 13.

-[Unknown]

Offline homeslice

  • Jr. Member
  • **
  • Posts: 183
  • Gender: Male
  • Usin' braincells as dippin' sauce
    • Wordabuse
Re: Different board Icons
« Reply #38 on: January 20, 2005, 12:14:24 PM »
Ok I understand how to use one icon for a certain forum, but I dont get the multiple icon part, where do u put the next boardid and pic link, could u post up an example of 5 different forums on 1 board with on & off switches (the code) so I can see what u mean

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Different board Icons
« Reply #39 on: January 20, 2005, 12:21:36 PM »
Again.

YOU DO NOT PUT THE IDS IN THE FILE.

The only place you put the ids is in the FILENAMES of the IMAGES.  You have:

on##.gif
on2##.gif
off##.gif

As I said above.  Do NOT PUT ANY IDS in the TEMPLATE FILE.  It should ONLY HAVE the 'id' part, which should not be NUMBERS, but rather an I and then a D, both LOWERCASE.  Why is that not clear?

When you make that modifcation, all your board's icons will show up as red X's.  Once you create the icons, and put them in the proper place, the X icons will go away.

-[Unknown]