Skip to:
Content
Pages
Categories
Search
Top
Bottom

Tabling the categories & non-categories on it's own.

  • @gerikg

    Member

    This is going to be complex to explain but I’m going to try.

    This is from front-page.php

    <?php if ( bb_forums() ) : ?>
    <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 while ( bb_forum() ) : ?>
    <?php if (bb_get_forum_is_category()) : ?>
    <tr<?php bb_forum_class('bb-category'); ?>>
    <td colspan="3"><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> – ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
    </tr>
    <?php continue; endif; ?>
    <tr<?php bb_forum_class(); ?>>
    <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> – ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
    <td class="num"><?php forum_topics(); ?></td>
    <td class="num"><?php forum_posts(); ?></td>
    </tr>
    <?php endwhile; ?>
    </table>
    <?php endif; // bb_forums() ?>

    This basic says the table headings are Main Theme, Topics, and Post. I wanted each category to be in it’s own table.

    So if you have a category, let’s say category “Welcome” and a child forum “Welcome to Our Site” and a category “Support” and child forum “PHP Help” it will display: (the dashes are spaces, ignore them)

    -Main Theme


    Topic–Post

    -Welcome


    —Welcome to Our Site


    0


    0

    -Support


    —PHP Help



    0


    0

    but I wanted:

    –Welcome


    Topic–Post

    —Welcome to Our Site


    0


    0

    -Support


    Topic–Post

    —PHP Help



    0


    0

    SO I thought it was easy so I did this:

    <?php if ( bb_forums() ) : ?>
    <h2><?php _e('Forums'); ?></h2>

    <?php while ( bb_forum() ) : ?>
    <?php if (bb_get_forum_is_category()) : ?>
    <table id="forumlist">
    <tr<?php bb_forum_class('bb-category'); ?>>
    <th><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><br /><?php forum_description( array( 'before' => '<small>', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?> <th><?php _e('Topics'); ?></th>
    <th><?php _e('Posts'); ?></th></td>
    </tr>
    <?php continue; endif; ?>
    <tr<?php bb_forum_class(); ?>>
    <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><br /><?php forum_description( array( 'before' => '<small>', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
    <td class="num"><?php forum_topics(); ?></td>
    <td class="num"><?php forum_posts(); ?></td>
    </tr>

    <?php endwhile; ?>
    </table>
    <?php endif; // bb_forums() ?>

    Which works great but I have to have every title under a category now. If I have a forum title “Websites” not under a category, this is what I get:

    Websites00

    –Welcome


    Topic–Post

    —Welcome to Our Site


    0


    0

    -Support


    Topic–Post

    —PHP Help



    0


    0

    Or it latches itself to another category

    –Welcome


    Topic–Post

    —Welcome to Our Site


    0


    0

    —PHP Help


    0


    0

    -Support


    Topic–Post

    —PHP Help



    0


    0

    So I need a statement that says if it’s not in a category it will print the title ONCE

    <tr>
    <th><?php _e('Main Theme'); ?></th>
    <th><?php _e('Topics'); ?></th>
    <th><?php _e('Posts'); ?></th>
    </tr>

    So it will print:

    –Welcome


    Topic–Post

    —Welcome to Our Site


    0


    0

    -Support


    Topic–Post

    —PHP Help



    0


    0

    -Main Theme


    Topic–Post

    —PHP Help


    0


    0

    Make sense?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar