/**
 * Main template for displaying the list of boards
 */
function template_boards_list()
{
    global $context, $txt, $theme_bi_alternating_row;
    $theme_bi_alternating_row = 0;
    // 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.)
    foreach ($context['categories'] as $category) {
        // If there are no parent boards we can see, avoid showing an empty category (unless its collapsed).
        if (empty($category['boards']) && !$category['is_collapsed']) {
            continue;
        }
        // @todo - Invent nifty class name for boardindex header bars.
        echo '
		<div class="forum_category" id="category_', $category['id'], '">
			<h2 class="category_header">';
        // If this category even can collapse, show a link to collapse it.
        if ($category['can_collapse']) {
            echo '
				<a class="collapse" href="', $category['collapse_href'], '" title="', $category['is_collapsed'] ? $txt['show'] : $txt['hide'], '">', $category['collapse_image'], '</a>';
        }
        // The "category link" is only a link for logged in members. Guests just get the name.
        echo '
				', $category['link'], '
			</h2>';
        // Assuming the category hasn't been collapsed...
        if (!$category['is_collapsed']) {
            template_list_boards($category['boards'], 'category_' . $category['id'] . '_boards');
        }
        echo '
		</div>';
    }
}
/**
 * Used to display sub-boards.
 */
function template_display_child_boards_above()
{
    global $context, $txt;
    echo '
	<div id="board_', $context['current_board'], '_childboards" class="forum_category">
		<h2 class="category_header">
			', $txt['parent_boards'], '
		</h2>';
    template_list_boards($context['boards'], 'board_' . $context['current_board'] . '_children');
    echo '
	</div>';
}