bbPress

Simple, Fast, Elegant

bbPress support forums » Troubleshooting

sub-sub forums

(6 posts)
  • Started 1 year ago by warmechoco
  • Latest reply from SamBauers
  • This topic is not resolved

Tags:

  1. warmechoco
    Member

    Hi,
    can anyone give me help doing this?
    front page:
    -Forum
    -Subforum
    Subsubforum1, Subsubforum2, Subsubforum 3

    how can I put the subsubforum next to eachother?

    or if not possible: only show the subsubforums as topics (not on the frontpage)

    Posted 1 year ago #
  2. Check this screenshot
    If this what you need, then open your front-page.php and forum.php. Find

    <?php while ( bb_forum() ) : ?>
    <tr<?php bb_forum_class(); ?>>
        <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><small><?php forum_description(); ?></small><?php bb_forum_pad( '</div>' ); ?></td>
        <td class="num"><?php forum_topics(); ?></td>
        <td class="num"><?php forum_posts(); ?></td>
    </tr>
    <?php endwhile; ?>

    Replace this (7 lines) with

    <?php while ( bb_forum() ) :
    global $bb_forums_loop;
    $_loop =& $bb_forums_loop;
    if($_loop->walker->depth == 3) : ?>
    <tr<?php bb_forum_class(); ?>>
        <td colspan="3"><?php bb_forum_pad( '<div class="nest">' ); ?>Subsubforums:
    <?php while ($_loop->walker->depth > 2) : ?>
            <a href="<?php forum_link(); ?>"><?php forum_name(); ?></a>
    <?php
            bb_forum();
            if ($_loop !== null && $_loop->walker->depth > 2)
                echo ', ';
            endwhile;
    ?>
        </td>
    </tr>
    <?php endif; ?>
    <?php if ($_loop !== null) : ?>
    <tr<?php bb_forum_class(); ?>>
        <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><small><?php forum_description();?></small><?php bb_forum_pad( '</div>' ); ?></td>
        <td class="num"><?php forum_topics(); ?></td>
        <td class="num"><?php forum_posts(); ?></td>
    </tr>
    <?php endif; endwhile; ?>

    Note that this code prints out all descendants of a subforum together, not only in subsubforum level. If you need only subsubforums, then please use the code from http://www.livibetter.com/it/topic/example-3-level-forums-list?replies=1

    Posted 1 year ago #
  3. warmechoco
    Member

    Hi! thanks alot for the help,
    only 1 problem.. my pages don't have that kind of structure..

    forum.php

    <?php bb_get_header(); ?>
    
    <h3 class="bbcrumb"><a href="<?php bb_option('uri'); ?>"><?php bb_option('name'); ?></a> &raquo; <?php forum_name(); ?></h3>
    
    <?php if ( $topics || $stickies ) : ?>
    
    <table id="latest">
    <tr>
    	<th><?php _e('Topic'); ?> — <?php new_topic(); ?></th>
    	<th><?php _e('Posts'); ?></th>
    	<th><?php _e('Last Poster'); ?></th>
    	<th><?php _e('Freshness'); ?></th>
    </tr>
    
    <?php if ( $stickies ) : foreach ( $stickies as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    	<td><?php _e('Sticky:'); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big></td>
    	<td class="num"><?php topic_posts(); ?></td>
    	<td class="num"><?php topic_last_poster(); ?></td>
    	<td class="num"><small><?php topic_time(); ?></small></td>
    </tr>
    <?php endforeach; endif; ?>
    
    <?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    	<td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
    	<td class="num"><?php topic_posts(); ?></td>
    	<td class="num"><?php topic_last_poster(); ?></td>
    	<td class="num"><small><?php topic_time(); ?></small></td>
    </tr>
    <?php endforeach; endif; ?>
    </table>
    <a href="<?php forum_rss_link(); ?>"><?php _e('RSS feed for this forum'); ?></a>
    
    <div class="nav">
    <?php forum_pages(); ?>
    </div>
    <?php endif; ?>
    <?php post_form(); ?>
    
    <?php bb_get_footer(); ?>

    front-page.php

    <?php bb_get_header(); ?>
    
    <?php if ( $forums ) : ?>
    
    <div id="discussions">
      <h2>
    
        <?php _e('Forums'); ?>
      </h2>
      <table id="forumlist">
        <tr>
          <th><?php _e('Main Theme'); ?></th>
          <th><?php _e('Topics'); ?></th>
          <th><?php _e('Posts'); ?></th>
        </tr>
        <?php foreach ( $forums as $forum ) : ?>
        <tr<?php alt_class('forum'); ?>>
          <td><a href="<?php forum_link(); ?>">
            <?php forum_name(); ?>
            </a> — <small>
              <?php forum_description(); ?>
            </small></td>
          <td class="num"><?php forum_topics(); ?></td>
          <td class="num"><?php forum_posts(); ?></td>
        </tr>
        <?php endforeach; ?>
      </table>
      <?php if ( bb_is_user_logged_in() ) : ?>
      <?php endif; else : // $forums ?>
      <h3 class="bbcrumb"><a href="<?php bb_option('uri'); ?>">
        <?php bb_option('name'); ?>
      </a></h3>
      <?php post_form(); endif; ?>
    
    <?php if ( $topics || $super_stickies ) : ?>
    
    <h2><?php _e('Latest Discussions'); ?></h2>
    
    <table id="latest">
    <tr>
    	<th><?php _e('Topic'); ?> — <?php new_topic(); ?></th>
    	<th><?php _e('Posts'); ?></th>
    	<th><?php _e('Last Poster'); ?></th>
    	<th><?php _e('Freshness'); ?></th>
    </tr>
    
    <?php if ( $super_stickies ) : foreach ( $super_stickies as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    	<td><?php _e('Sticky:'); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big></td>
    	<td class="num"><?php topic_posts(); ?></td>
    	<td class="num"><?php topic_last_poster(); ?></td>
    	<td class="num"><small><?php topic_time(); ?></small></td>
    </tr>
    <?php endforeach; endif; ?>
    
    <?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    	<td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
    	<td class="num"><?php topic_posts(); ?></td>
    	<td class="num"><?php topic_last_poster(); ?></td>
    	<td class="num"><small><?php topic_time(); ?></small></td>
    </tr>
    <?php endforeach; endif; ?>
    </table>
    <?php endif; ?>
    </div>
    
    <?php bb_get_footer(); ?><?php bb_get_header(); ?>
    
    <?php if ( $forums ) : ?>
    
    <div id="discussions">
      <h2>
    
        <?php _e('Forums'); ?>
      </h2>
      <table id="forumlist">
        <tr>
          <th><?php _e('Main Theme'); ?></th>
          <th><?php _e('Topics'); ?></th>
          <th><?php _e('Posts'); ?></th>
        </tr>
        <?php foreach ( $forums as $forum ) : ?>
        <tr<?php alt_class('forum'); ?>>
          <td><a href="<?php forum_link(); ?>">
            <?php forum_name(); ?>
            </a> — <small>
              <?php forum_description(); ?>
            </small></td>
          <td class="num"><?php forum_topics(); ?></td>
          <td class="num"><?php forum_posts(); ?></td>
        </tr>
        <?php endforeach; ?>
      </table>
      <?php if ( bb_is_user_logged_in() ) : ?>
      <?php endif; else : // $forums ?>
      <h3 class="bbcrumb"><a href="<?php bb_option('uri'); ?>">
        <?php bb_option('name'); ?>
      </a></h3>
      <?php post_form(); endif; ?>
    
    <?php if ( $topics || $super_stickies ) : ?>
    
    <h2><?php _e('Latest Discussions'); ?></h2>
    
    <table id="latest">
    <tr>
    	<th><?php _e('Topic'); ?> — <?php new_topic(); ?></th>
    	<th><?php _e('Posts'); ?></th>
    	<th><?php _e('Last Poster'); ?></th>
    	<th><?php _e('Freshness'); ?></th>
    </tr>
    
    <?php if ( $super_stickies ) : foreach ( $super_stickies as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    	<td><?php _e('Sticky:'); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big></td>
    	<td class="num"><?php topic_posts(); ?></td>
    	<td class="num"><?php topic_last_poster(); ?></td>
    	<td class="num"><small><?php topic_time(); ?></small></td>
    </tr>
    <?php endforeach; endif; ?>
    
    <?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    	<td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
    	<td class="num"><?php topic_posts(); ?></td>
    	<td class="num"><?php topic_last_poster(); ?></td>
    	<td class="num"><small><?php topic_time(); ?></small></td>
    </tr>
    <?php endforeach; endif; ?>
    </table>
    <?php endif; ?>
    </div>
    
    <?php bb_get_footer(); ?><?php bb_get_header(); ?>
    
    <?php if ( $forums ) : ?>
    
    <div id="discussions">
      <h2>
    
        <?php _e('Forums'); ?>
      </h2>
      <table id="forumlist">
        <tr>
          <th><?php _e('Main Theme'); ?></th>
          <th><?php _e('Topics'); ?></th>
          <th><?php _e('Posts'); ?></th>
        </tr>
        <?php foreach ( $forums as $forum ) : ?>
        <tr<?php alt_class('forum'); ?>>
          <td><a href="<?php forum_link(); ?>">
            <?php forum_name(); ?>
            </a> — <small>
              <?php forum_description(); ?>
            </small></td>
          <td class="num"><?php forum_topics(); ?></td>
          <td class="num"><?php forum_posts(); ?></td>
        </tr>
        <?php endforeach; ?>
      </table>
      <?php if ( bb_is_user_logged_in() ) : ?>
      <?php endif; else : // $forums ?>
      <h3 class="bbcrumb"><a href="<?php bb_option('uri'); ?>">
        <?php bb_option('name'); ?>
      </a></h3>
      <?php post_form(); endif; ?>
    
    <?php if ( $topics || $super_stickies ) : ?>
    
    <h2><?php _e('Latest Discussions'); ?></h2>
    
    <table id="latest">
    <tr>
    	<th><?php _e('Topic'); ?> — <?php new_topic(); ?></th>
    	<th><?php _e('Posts'); ?></th>
    	<th><?php _e('Last Poster'); ?></th>
    	<th><?php _e('Freshness'); ?></th>
    </tr>
    
    <?php if ( $super_stickies ) : foreach ( $super_stickies as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    	<td><?php _e('Sticky:'); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big></td>
    	<td class="num"><?php topic_posts(); ?></td>
    	<td class="num"><?php topic_last_poster(); ?></td>
    	<td class="num"><small><?php topic_time(); ?></small></td>
    </tr>
    <?php endforeach; endif; ?>
    
    <?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    	<td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
    	<td class="num"><?php topic_posts(); ?></td>
    	<td class="num"><?php topic_last_poster(); ?></td>
    	<td class="num"><small><?php topic_time(); ?></small></td>
    </tr>
    <?php endforeach; endif; ?>
    </table>
    <?php endif; ?>
    </div>
    
    <?php bb_get_footer(); ?>
    Posted 1 year ago #
  4. I checked the svn repos. It seems you are using bbPress prior to 0.8.2, please upgrade first.

    Posted 1 year ago #
  5. warmechoco
    Member

    Hello, I upgraded,
    but I'm using a template of my own,
    and I have to change the forum.php & front-page.php, but they don't change when you upgrade??

    Posted 1 year ago #
  6. You have to keep your custom templates up to date your self.

    You might want to use the browser in the trac site to see which files have changed.

    http://trac.bbpress.org/browser/trunk/bb-templates/kakumei

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.