Flipping Child Boards to Bottom Instead of Top Position

Started by Willie, June 21, 2011, 02:42:30 PM

Previous topic - Next topic

Willie

Is it possible to put my "chidren" below their parents?  I hate the child boards because they take away from the main board.  Is there a provision to exchange their positions in 2.0, curves? If not, is there a mod that will?

Antechinus

Not aware of a mod that does it, but you can do it by editing MessageIndex.template.php.

Find this lot (Lines 20 -125 inclusive on a fresh file):

if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0))
{
echo '
<div class="tborder childboards" id="board_', $context['current_board'], '_childboards">
<div class="cat_bar">
<h3 class="catbg">', $txt['parent_boards'], '</h3>
</div>
<div class="table_frame">
<table class="table_list">
<tbody id="board_', $context['current_board'], '_children" class="content">';

foreach ($context['boards'] as $board)
{
echo '
<tr id="board_', $board['id'], '" class="windowbg2">
<td class="icon windowbg"', !empty($board['children']) ? ' rowspan="2"' : '', '>
<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';

// If the board or children is new, show an indicator.
if ($board['new'] || $board['children_new'])
echo '
<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
// Is it a redirection board?
elseif ($board['is_redirect'])
echo '
<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
// No new posts at all! The agony!!
else
echo '
<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';

echo '
</a>
</td>
<td class="info">
<a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';

// Has it outstanding posts for approval?
if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
echo '
<a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>';

echo '

<p>', $board['description'] , '</p>';

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

// Show some basic information about the number of posts, etc.
echo '
</td>
<td class="stats windowbg">
<p>', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
</p>
</td>
<td class="lastpost">';

/* 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 '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';

echo '
</td>
</tr>';

// 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)
{
if (!$child['is_redirect'])
$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" />' : '') . '</a>';
else
$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';

// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';

$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
}
echo '
<tr id="board_', $board['id'], '_children"><td colspan="3" class="children windowbg"><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</td></tr>';
}
}
echo '
</tbody>
</table>
</div>
</div>';
}


Delete it from where it is and paste it just before this:

// Show breadcrumbs at the bottom too.
theme_linktree();


Actually I'll move this to Tips and Tricks as we do see a few requests for this and I've thought about doing it myself on my site.

Come to think of it, I should just package it as a mod. Very easy to do.

Antechinus

Hey Willie: mod attached. Tested on my local host. No errors in the log. Installs and uninstalls cleanly on the 2.0 default theme. Not coded for any other themes.

Not approved by the Customise team yet, so use at your own risk for now. I very much doubt it will break anything though, unless you try to install it on a theme that has a customised MessageIndex.template.php.

Willie

Thanks.   Let's look at the default setup now and why I don't think it is good.

When I have a child board, it is because there is a need to group many topics that deal with the basic issue together. I could create a new board, not a child board, but the topic is closely associated with the parent board. So, I want it designated a "child board".  But, if it is a child board, it is not the main board.  So, when a user comes onto the page looking for my parent board, what does he see first? The child, or worse five or six children, pushing the main board way down the page. It is not correct.  I believe I understand why it was done, but it is not good. If the parent board is put where it belongs, at the top, then the child boards can be displayed right beneath them. Yes, the topics on the parent board will be shortened in number because of the child boards needing room, but that is the case anyway.

And,  I think that curves has improved the visibility on the index page for child boards, but it needs to be improved more.   It is not a stand alone board, but it is just as important as the parent board. It just needs to be in its proper sphere, below the parent. The whole intent is to help the user find the child board and not lose the parent board and its connection with the child.

Thanks for your interest in this subject,  Antechinus.   It is one that will help the admins and users as we move through the SMF boards.  I appreciate your work. It is a great message board. I spend much time working with it.  I left UBB and have never been sorry.

Advertisement: