Author Topic: Child Boards in 3 lines  (Read 5709 times)

Offline cerb3ros

  • Jr. Member
  • **
  • Posts: 15
    • Email
Child Boards in 3 lines
« on: Oct 17, 2007, 00:52:43 »
Hello :)

First of all, its one of the best skins for SMF i have found over the net, gratz you created it, and double gratz you offer it for free

What i want to do, is to have child forums in a table (3 per line perhaps) and have them with icons for each one of them. I am suprised that no one have made a mod for this yet (was a big hit at Vbulletin, which i had for years).
But if someone can tell me what code to add where, will be awesome :)

Do u know perhaps, how to add this?

Ty in advance as always,

Offline Bikken

  • Administrator
  • Hero Member
  • *
  • Posts: 4030
  • I doubt that!
    • DzinerStudio
Child Boards in 3 lines
« Reply #1 on: Oct 17, 2007, 05:33:13 »
Hello :)

First of all, its one of the best skins for SMF i have found over the net, gratz you created it, and double gratz you offer it for free

What i want to do, is to have child forums in a table (3 per line perhaps) and have them with icons for each one of them. I am suprised that no one have made a mod for this yet (was a big hit at Vbulletin, which i had for years).
But if someone can tell me what code to add where, will be awesome :)

Do u know perhaps, how to add this?

Ty in advance as always,

Hi, thank you and your welcome  :)

Well, you will need to modify BoardIndex.template file to accomplish that. Take a copy of that file from default theme and paste it in this themes folder. Then Search for "Show the child boards" somewhere at the beginning of that file and edit the code there.

Sorry, i don't have a great deal of time to look at this myself for the moment.  :-\
DzinerStudio Demos
http://demo.dzinerstudio.com

Get your own theme copy!
Browse Downloads | Become a Club Member

Offline cerb3ros

  • Jr. Member
  • **
  • Posts: 15
    • Email
Child Boards in 3 lines
« Reply #2 on: Oct 17, 2007, 22:05:38 »
Ty, the only thing tha is missing is what code to add:)

When u will have some more time free, please do reply, i am not in rush:)

Ty again

Offline y0ze

  • Jr. Member
  • **
  • Posts: 15
    • Email
Child Boards in 3 lines
« Reply #3 on: Oct 30, 2007, 11:58:06 »
What i want to do, is to have child forums in a table (3 per line perhaps) and have them with icons for each one of them. I am suprised that no one have made a mod for this yet (was a big hit at Vbulletin, which i had for years).
But if someone can tell me what code to add where, will be awesome :)

If you have the code maybe you can share it with me (us) I really liek to have that to.

Thanks.

By the way... just installed Overview and it looks great, good work!

Offline y0ze

  • Jr. Member
  • **
  • Posts: 15
    • Email
Child Boards in 3 lines
« Reply #4 on: Nov 01, 2007, 02:02:42 »
You mean this way i asume (style: Diber MC)


Offline Bikken

  • Administrator
  • Hero Member
  • *
  • Posts: 4030
  • I doubt that!
    • DzinerStudio
Child Boards in 3 lines
« Reply #5 on: Nov 01, 2007, 06:42:38 »
Ah i see. Well, you can always have a look at the BoardIndex.template file of that theme and maybe you get the idea how it's done.  ;)
DzinerStudio Demos
http://demo.dzinerstudio.com

Get your own theme copy!
Browse Downloads | Become a Club Member

Offline y0ze

  • Jr. Member
  • **
  • Posts: 15
    • Email
Child Boards in 3 lines
« Reply #6 on: Nov 02, 2007, 03:57:24 »
Hm, i'm not a coder, so i tried some simple cut and paste ;-)

1. In your forum directory locate the file  "BoardIndex.template.php" found in the "Themes/default" directory.

2. Open the file in an editor and locate the text between:

Code: [Select]
/* 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 image),
and boards. (see below.) */

AND (Including)

Code: [Select]
</td>
</tr>';
}
}
echo '
</table>';
}
echo '
</div>';
}

Replace with

Code: [Select]
/* 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.) */
$first = true;
foreach ($context['categories'] as $category)
{
echo '
<div class="tborder" style="margin-top: ' , $first ? '0;' : '1ex;' , '' , $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'width: 100%;' : '', '">
<div class="catbg', $category['new'] ? '2' : '', '" style="padding: 5px 5px 5px 10px;">';
$first = false;

// If this category even can collapse, show a link to collapse it.
if ($category['can_collapse'])
echo '
<span style="float:right; margin-right:15px;"><a href="', $category['collapse_href'], '"><img src="', $settings['images_url'] . '/', !$category['is_collapsed'] ? 'collapse.gif' : 'expand.gif', '" alt="*" /></a></span>';

echo '
<span style="margin-left:80px;">', $category['link'], '</span>
</div>';




// Assuming the category hasn't been collapsed...
if (!$category['is_collapsed'])
{
echo '
<table border="0" width="100%" cellspacing="1" cellpadding="5" class="bordercolor" style="margin-top: 0px;">

',
empty($settings['boardname_posts_lastposts_nodisplay']) ? '<tr>
<td class="titlebg3" width="51" align="center" valign="middle">

</td>
<td class="titlebg3">
'. $txt[20].'
</td>
<td class="titlebg3" valign="middle" align="center" style="width: 12ex;">
'. $txt[21].'
</td>
<td class="titlebg3" valign="middle" align="center" width="22%">
'. $txt[22].'
</td>
</tr>' : '' ;

/* 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="51" align="center" valign="middle"><a href="', $scripturl, '?action=unread;board=', $board['id'], '.0">';

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

echo '</a>
</td>
<td class="windowbg2" style="padding-top:12px; padding-bottom:12px;">
<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"><br/><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'] ? '<img style="margin-right:5px;" src="' . $settings['images_url'] . '/' . 'onk.gif" alt="' . $txt[333] . '"/><b>' . $child['link'] . '</b>' : '<img style="margin-right:5px;" src="' . $settings['images_url'] . '/' . 'offk.gif" alt="' . $txt[334] . '"/>' . $child['link'];
}

echo '
<table style="float:right; margin-top: 15px;" width="100%" cellspacing="0" cellpadding="3" border="0">
<tr>
<td class="middletext" valign="middle" align="center" width="30%">
<b>', $txt['parent_boards'], ':</b> ';

$child_counter = 0;

if(empty($settings['child_boards_rows']))
{
echo '
</td>
<td class="middletext" valign="top">';

for(; $child_counter < ceil(count($children)/2); $child_counter++)
echo $children[$child_counter], '<br/>';
}

echo '
</td>
<td class="middletext" valign="top">';
for(; $child_counter < count($children); $child_counter++)
echo $children[$child_counter], '<br/>';
echo '
</td>
</tr>
</table>';
}
// 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>';
}
echo '
</table>';
}
echo '
</div>';
}

This is the display code minus the $settings['theme_main_color'] field which places the directory of the Multi Color options into the file locations.

3. Create two images named "offk.gif" and "onk.gif" with a size around 10x10 pixels (you can call these anything you like as long as you change the filenames in the relevant places in the code given above). Upload them to your "Themes/default/images" directory. These images will display next to the child board names to show whether there are new posts in that board (onk.gif) or no new posts (offk.gif), the same way as the main icons next to a board do.

When that's done you will have the same child board layout as the Dilber MC theme but in the default (or any other theme you integrate it with).

It's also worth noting that if you use the Ad Management mod then you need to add the following code before the final "}"  (or unistall that mod prior to making the changes then re-install)

Code: [Select]
//Display ads Between cats
if (function_exists("show_category"))
{
$ads = show_category($category['id']);
if(!empty($ads))
if($ads['type']==0)
echo $ads['content'];
else
eval($ads['content']);
unset($ads);
}



I did this, but the child boards are not good aligned. any thoughts?
« Last Edit: Nov 02, 2007, 04:32:02 by y0ze »

Offline y0ze

  • Jr. Member
  • **
  • Posts: 15
    • Email
Child Boards in 3 lines
« Reply #7 on: Nov 02, 2007, 04:37:38 »
This is how it looks now. Not alligned...


Offline y0ze

  • Jr. Member
  • **
  • Posts: 15
    • Email
Re: Child Boards in 3 lines
« Reply #8 on: Dec 17, 2007, 12:08:48 »
I checked everything and re-did the modification again. But still the child forums are not aligned. If i switch to the default theme, the problem is the same.

Someone a idea what is wrong? Can it also be in the CSS file?

If someone here will have a look that would be great.

Offline y0ze

  • Jr. Member
  • **
  • Posts: 15
    • Email
Re: Child Boards in 3 lines
« Reply #9 on: Dec 18, 2007, 04:17:10 »
A friend solved the problem. Boardindex is attached to this post.