Skip to:
Content
Pages
Categories
Search
Top
Bottom

If forum is NOT category

  • if (bb_get_forum_is_category())

    That’s if forum is category, how do I write if it’s not a category?

Viewing 12 replies - 1 through 12 (of 12 total)

  • chrishajer
    Participant

    @chrishajer

    Is it as simple as:

    <?php if ( !bb_get_forum_is_category() ) {
    // whatever
    ?>


    chrishajer
    Participant

    @chrishajer

    I suppose you could do the complete noob thing and say:

    <?php if (bb_get_forum_is_category()) {
    continue;
    }
    else {
    // do something
    }
    ?>

    Unless I am completely missing your point and this is some sort of test :-)

    <?php if (bb_get_forum_is_category()) {; ?>
    <table id="forumlist">
    <tr<?php bb_forum_class('bb-category'); ?>>
    <td colspan="4" class="cattile"><?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>
    <tr>
    <th colspan="2"><?php _e('Main Theme'); ?></th>
    <th><?php _e('Topics'); ?></th>
    <th><?php _e('Posts'); ?></th>
    </tr>
    <?php } else { ?>
    <table id="forumlist">
    <tr>
    <th colspan="2"><?php _e('Main Theme'); ?></th>
    <th><?php _e('Topics'); ?></th>
    <th><?php _e('Posts'); ?></th>
    </tr>
    <?php };?>
    <?php continue; endif; ?>

    I can’t get it right..

    http://img690.imageshack.us/img690/6453/28175250.jpg

    The one circle is not under a category. I want it to be under it’s own Table. With the headings Main Theme, Topics, and Post.


    chrishajer
    Participant

    @chrishajer

    I think the problem then is you are going to need two loops. You’re processing all forums in order and then will just come out in order, right, no matter if they are categories or not? Don’t you want two tables, one table of all your forums that are categories, then another table of just forums that are forums (not categories)? Or are you handling the order of the forums to make them come out in the right order, so that the tables will be displayed in order?

    Can you post a link to this forum (or send it to me) so we can see the source and see exactly how they’re being processed and what’s going wrong?


    kevinjohngallagher
    Member

    @kevinjohngallagher

    I think i can shed a little light on this, but apologies if i’m off a little.

    1) you need to decide if you want to have parent/child relationships with categories or not. If you want categories, then all forums need to have a parent category. Its a world of hassle otherwise.

    2) bbPress doesn’t actually handle in any way shape or form a parent / child relationship. Its key to remember this when processing the data, especially in the bb_forums() loop. Remember it’s just a plain list of names with no corrolation.

    3) The “category” is not marked on the forum list or forum database table where you can query it easily as a 1 to 1 relationship. Instead, a hack of _CK_’s forum as a category plugin for bbPress 0.8/0.9 has been rolled into the core. Thats not a complaint against Sam, its the fact that it doesn’t solve the problem, it merely “fakes” a category to the end user.

    4) bbPress doesn’t consider a category to be in a Parent/Child relationship, it considers a category to be one that topics cant be written to AND that has a child forum. So if down the line you make a forum read only for some reason – bbPress will think its a category.

    Here is a long (sorry) post I wrote about it in September 2008:

    https://bbpress.org/forums/topic/parent-childrelationship-in-forum-loop

    And in the end I made this as an example:

    http://kevinjohngallagher.com/___alpha/bbpress_as_phpbb/

    Basically, I had to do a major rewrite of the bb_forums() loop.


    chrishajer
    Participant

    @chrishajer

    I remember that now …

    @kevinjohngallagher, thank you! I was afraid of that. I was trying to make a theme that works both ways I guess it’s not an option. How did you get the “last topic” & “last user” to post?

    @chrishajer you still want a crack at it?


    chrishajer
    Participant

    @chrishajer

    gerikg, what is your forum structure, and what do you want it to look like on the front end?


    psycheangels
    Member

    @psycheangels

    hmm maybe you can make a condition that check if there is no parent category in that forum (by depth). i think i have seen the code for your problem in this forum but i forgot to bookmark it

    @chrishajer based on what kevinjohngallagher said I don’t think it’s possible, he got close. It’s not necessary anymore, thank you. There are other questions that are important right now.

    @psycheangels great

    Maybe we should have on FAQ post with only Question and Answer by a moderator ::coughchriscough:: (Since there is only one! You need to change your icon to a highlander icon)

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