Categories & Boards

Started by homeslice, January 11, 2005, 10:23:42 PM

Previous topic - Next topic

homeslice

I would like to rearrange each category with it's boards in a new format instead of just the norm list of text links for each board

example:



There doesnt have to be icons, I just want the set up to look like this

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


[Unknown]

For the record, Homeslice, this it totally possible... but I'm afraid I'm currently too tired to work out the code and tell you how to do it without making a mistake.

However, I do mean to post how to do this when I have a chance.

-[Unknown]

homeslice

Thanks for responding  ;D Yeah, this would be a cool theme if someone made it look exactly like the pic I put up

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


Jerry

if you search the forums, you can have a different image for every forum also :)


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Elijah Bliss

Quote from: homeslice on January 11, 2005, 10:23:42 PM
I would like to rearrange each category with it's boards in a new format instead of just the norm list of text links for each board

example:



There doesnt have to be icons, I just want the set up to look like this

Nice layout, I likes. Hey homeslice, if you need a lot of customization to your forum you should really consider the Charter Membership plan, worth every penny and way more.

Grudge

Well, I suck at HTML but this took me about 5-10 mins:

In Boardindex.template.php find:

foreach ($context['categories'] as $category)


and replace the whole foreach block (about 100 lines) with this:

foreach ($context['categories'] as $category)
{
echo '
<div align="center"><table border="0" width="780" cellspacing="1" cellpadding="5" class="tborder">
<tr>
<td colspan="4" class="catbg', $category['new'] ? '2' : '', '" 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>';

// Assuming the category hasn't been 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.) */
$number = 0;
foreach ($category['boards'] as $board)
{
if ($number % 2 == 0)
echo '
<tr class="windowbg2" height="30">';

echo '
<td class="windowbg" width="50" 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" />';

echo '</td><td
<td align="left" width="360">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'], '
</td>';

if ($number % 2 == 1)
echo '
</tr>';
$number++;
}
}
// If we had an odd amount of boards - fill it out.
if ($number % 2 == 1)
echo '
<td width="50" class="windowbg"></td><td width="360"></td></tr>';

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


It will still need a lot of tweaking, but you can see the basic effect on the attached image.

And there are plenty of posts about how to set images per board - hope it helps in some way.
I'm only a half geek really...

homeslice

Ok looks cool a few problems I need help on though are:
1. The New Posts, No New posts legend at the bottom is gone now,
2. also I would like the latest post link still viewable underneath the topic description so u can see whats new inside
3. The line below the news box and above the categories that says:

Board name |  Topics |  Posts |    Last post

that bars is still there and I want to remove it
4.is there a way to center the boardname and description inside each box so their not left aligned?

Overall tho my board looks much nicer thanks to Grudge for the help

You guys put in alot of work here, thanks much

and Jerry I will consider that Charter Membership but Im low on funds at the moment

1

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


homeslice

Sorry to ask for so much I know ya'll are busy

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


Mystica

to 1.: did you maybe remove this code under the foreach block?

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

that's the code that displays the legend.

to 3.: remove this part of the boardindex.template:

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

(that's if you are working from the classic theme, in other themes the code might look a bit different, look for the $txt[number]'s then)

to 4.: replace the align attribute in this code:

  echo '</td><td
<td align="left" width="360">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'], '
</td>';
~ there's nothing wrong with me, this is how I'm supposed to be ~

homeslice

Ok and #2 was important too,

QuoteI would like the latest post link still viewable underneath the topic description so u can see whats new inside

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


Mystica

ok, this took a bit longer... for 2., try this:

foreach ($context['categories'] as $category)
{
echo '
<div align="center"><table border="0" width="780" cellspacing="1" cellpadding="5" class="tborder">
<tr>
<td colspan="4" class="catbg', $category['new'] ? '2' : '', '" 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>';

// Assuming the category hasn't been 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.) */
$number = 0;
foreach ($category['boards'] as $board)
{
if ($number % 2 == 0)
echo '
<tr class="windowbg2" height="30">';

echo '
<td class="windowbg" width="50" 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" />';

echo '</td>
<td align="left" width="360">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></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 '
<div style="padding-top: 1px;" class="smalltext"><i>', count($board['moderators']) == 1 ? $txt[298] : $txt[299], ': ', implode(', ', $board['link_moderators']), '</i></div>';

// 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 '
<div style="padding-top: 1px;" class="smalltext"><i>', $txt['parent_boards'], ': ', implode(', ', $children), '</i></div>';
}
echo '
<br />';
if (!empty($board['last_post']['id']))
echo '
<span class="smalltext">
', $txt[22], ' ', $txt[30], ' ', $board['last_post']['time'], '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], ' ', $txt[525], ' ', $board['last_post']['member']['link'], '</span>';
echo '
</td>';

if ($number % 2 == 1)
echo '
</tr>';
$number++;
}
}
// If we had an odd amount of boards - fill it out.
if ($number % 2 == 1)
echo '
<td width="50" class="windowbg"></td><td width="360"></td></tr>';

echo '
</table></div>
<br />';
}
~ there's nothing wrong with me, this is how I'm supposed to be ~

Midgard

There is no knowledge, that is not power....

Looking good layout...

homeslice

Perfecto, now I jus gotta figure out the different icon thingy

thanks ya'll

1

http://battle.ne1.net

Wordabuse Hip-Hop Forums!


motumbo

Cool!  I wanted to do something like this, too. 

There is so much useful information here that you just stumble upon by accident!

Advertisement: