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

haup9

I have it working! Thanks for all the help. ;D
[nofollow]

Anguz

Cristián Lávaque http://cristianlavaque.com


JayBachatero

#23
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
Follow me on Twitter

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

[Unknown]

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]

Anguz

Well, if he still wants it hardcoded, which all this tip is anyway, he could have this array right before the foreach


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


Then at the beginning of the foreach add this


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


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


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

Anguz

Just read that you may want to use the same image for more than one board, then you could do it like this


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



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

JayBachatero

#27
THIS IS WHAT I HAVE NOT SURE IF ITS CORRECT


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

Follow me on Twitter

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

Anguz

The line

$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

Anguz


<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

JayBachatero

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

Anguz

Quote from: LiL_J on December 27, 2004, 11:21:32 PM
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

JayBachatero

Quote from: Anguz on December 28, 2004, 12:31:08 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


homeslice

Could u give more detail to this explanation of making topic images, its confusing,

QuoteCode:
// 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!


homeslice

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 :

// 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...

// 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!


homeslice

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!


[Unknown]

Quote from: homeslice on January 19, 2005, 01:06:33 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]

homeslice

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!


[Unknown]

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]

Advertisement: