Hi Marco. I’m no expert at this (one or two will be along shortly…) but I’ve found that in playing around with PHP and CSS I’ve been able to do a lot more than I thought I would.
The code you’ve posted would display not just the forum names, but most of your front-page info. I’m wondering if putting the forum names in a < div > with a class name you’ve defined in the stylesheet to format the fornt, placing, width, etc., would do it. This is a rough ide from my front-page;
<div id="my_side_bar">
<?php if ( bb_forums() ) : ?>
<table id="forumlist">
<?php while ( bb_forum() ) : ?>
<tr<?php bb_forum_class(); ?>>
<td><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><br />
</td></tr>
<?php endwhile; ?>
</table>
<?php endif; // bb_forums() ?>
The table definition could probably be removed too, and it should(?) give a list of links with just forum names. Blind leading the blind here, but it might give you some ideas.
it’s more simple using static html
It may be simple using hard-coded html tags but php
code will serve the needs of all those who are looking for that functionality.
Michael’s code seems fine (I just don’t get the point of using table, should have been a list).
@ashfame; In the example I gave, I’d just pulled some stuff out of my front-page.php, which is a modified version of Kakumei. It has tables because it came that way – here’s the fist code section;
<div id="discussions">
<?php if ( bb_forums() ) : ?>
<h2><?php _e('Forums'); ?></h2>
<table id="forumlist">
<?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><br /><div class="hints"><?php forum_description(); ?> (<?php bb_forum_pad( '</div>' ); ?><?php forum_topics(); ?> topics, <?php forum_posts(); ?> posts)</div></td>
</tr>
<?php endwhile; ?>
</table>
<?php endif; // bb_forums() ?>
I read somewhere that using lists is not good (can’t remember why). I removed all the alternative line colourings to give a very simple layout, which you can see at http://mbforum.letsdoo.org.
How would I use a list to get the same layout? I once removed the remaining table stuff, but the page turned into a mess. A list will add bullets or numbering, won’t it?
@Marcomail; Thanks for raising this point about a sidebar forum list. I was curious and tested out the code I posted above, and it works very well (without the table definition). I just put the forum loop into the hottags div section and it looks fine. The site link is in my previous post if you want a look, and the code I used is;
<div id="hottags">
<h2><?php _e('Forums'); ?></h2>
<?php if ( bb_forums() ) : ?>
<?php while ( bb_forum() ) : ?>
<a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><br />
<?php endwhile; ?>
<?php endif; // bb_forums() ?>
<br />
<h2><?php _e('Tags'); ?></h2>
<p class="frontpageheatmap"><?php bb_tag_heat_map( 9, 13, 'pt', 50 ); ?></p>
</div>
It tidies up the front page a lot, and there’s less need to scroll down to see the recent posts. Cheers!
Ok, thanks. But if i have only 7/8 forum it’s more simple write the list manually and stop, the page will load more quickly and with less work for the db server.