HELP; I Want to Remove Child Boards From Board Index

Started by Gunpoint, July 21, 2012, 01:24:06 AM

Previous topic - Next topic

Gunpoint

Please I want to remove child boards from showing in the board index of my forum; Here is the code from boardindex.template.php

function template_main()
{
   global $context, $settings, $options, $txt, $scripturl, $modSettings;

   echo '
   <div id="boardindex_table">';
   foreach ($context['categories'] as $category)
   {
      // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
      if (empty($category['boards']) && !$category['is_collapsed'])
         continue;

      echo '
         <ul data-role="listview" data-inset="true" id="category_', $category['id'], '">
            <li data-role="list-divider">', $category['name'], '</li>';

      // Assuming the category hasn't been collapsed...
      if (!$category['is_collapsed'])
      {
         foreach ($category['boards'] as $board)
         {
            echo '
            <li data-theme="c"><a href="', $board['href'], '" name="b', $board['id'], '"', $board['is_redirect'] ? ' rel="external"' : '', '>';

            // If the board or children is new, show an indicator.
            if ($board['new'] || !empty($board['children_new']))
               echo '
               <img src="', $settings['images_url'], '/' .$context['theme_variant'], '/new_some.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" border="0" class="ui-li-icon" />';
            // Is it a redirection board?
            elseif ($board['is_redirect'])
               echo '
               <img src="', $settings['images_url'], '/' .$context['theme_variant'], '/new_redirect.png" alt="*" title="*" border="0" class="ui-li-icon" />';
            // No new posts at all! The agony!!
            else
               echo '
               <img src="', $settings['images_url'], '/' .$context['theme_variant'], '/new_none.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" class="ui-li-icon" />';
            echo '
               <h3>', $board['name'], '</h3>
               <p class="board_desc">', strip_tags($board['description']), '</p>';

            echo '</a>
            </li>';
            if (!empty($board['children']))
            {
               /* 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)
               {
                  echo '<li class="child_board"><a href="', $child['href'], '">';
                     // If the board or children is new, show an indicator.
                     if ($child['new'])
                        echo '
                           <img src="', $settings['images_url'], '/' .$context['theme_variant'], '/new_some.png" alt="', $txt['new_posts'], '" title="', $txt   ['new_posts'], '" border="0" class="ui-li-icon" />';
                     // Is it a redirection board?
                     elseif ($child['is_redirect'])
                        echo '
                           <img src="', $settings['images_url'], '/' .$context['theme_variant'], '/new_redirect.png" alt="*" title="*" border="0" class="ui-li-icon" />';
                     // No new posts at all! The agony!!
                     else
                        echo '
                           <img src="', $settings['images_url'], '/' .$context['theme_variant'], '/new_none.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" class="ui-li-icon" />';

                     echo '
                           <h3 class="ui-li-heading">', $child['name'], '</h3>';
                  echo '
                        </a></li>';
               }
            }
         }
         echo '
         </ul>';
      }
   }
   echo '
   </div>';
   $list_users = array();
   foreach ($context['users_online'] as $user)
      $list_users[] = (!empty($context['online_groups'][$user['group']]) ? '<span style="color: ' . $context['online_groups'][$user['group']]['color'] . ';">' . $user['name'] . '</span>' : $user['name']);

   echo '
   <ul data-role="listview" data-theme="c" data-dividertheme="b" style="margin-top: 10px;" data-inset="true">
      <li data-role="list-divider">
         <a href="', $scripturl, '?action=who">', $txt['who_title'], '</a>
      </li>
      <li>', sprintf($txt['boardindex_statistics'], $context['common_stats']['total_posts'], $context['common_stats']['total_topics'], $context['common_stats']['total_members'], comma_format($context['num_users_online'] + $context['num_users_hidden']), comma_format($context['num_guests'])), '
      </li>';
   if (!empty($list_users))
      echo '
      <li class="smalltext">', implode(', ', $list_users), '</li>';
   echo '
   </ul>';
}
?>

Colin

"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

Gunpoint

WOW; you just saved me a whole day's work. i thought i was going to be coding the whole of today. Thanks; mate

Colin

Glad to hear it  ;). Topic marked as solved. Have a good one.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

Advertisement: