Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Get Current Forum ID?


reclaimyourskin
Member

@reclaimyourskin

Sorry guys, I thought my problem was resolved but it looks like i’ve spoke to soon.

The code _CK_ suggested below, worked wonders to add a new “on” class on my forum links:

<li<?php if ($current_forum_id=get_forum_id()) {echo " class='on'";} ?>>

Problem!

The trouble is that the unique “on” class is being displayed on every forum link, when I need it to only display when i’m viewing forum 2 for example. Basically, i need a unique css class and current forum marker so the user knows which forum they are currently viewing.

Below is the souce code for all of forum.php (if anyone has time to have a quick look i’d really appreciate it).

<?php bb_get_header(); ?>

<h3><?php forum_name(); ?> Forum</h3>

<ul id=”forumnav”>

<li<?php if ($current_forum_id=get_forum_id()) {echo ” class=’on'”;} ?>>” title=”Latest homepage”><span>Latest<img src=”images/white-arrow.gif” style=”padding: 0 0 3px 5px” width=”10″ height=”5″ border=”0″ /></span>

<li<?php if ($current_forum_id=get_forum_id()) {echo ” class=’on'”;} ?>>forum/forum2″ title=”Forum 2″><span>Forum 2</span>

<li<?php if ($current_forum_id=get_forum_id()) {echo ” class=’on'”;} ?>>forum/forum3″ title=”Forum 3″><span>Forum 3</span>

<li class=”<?php echo $class;?>”>forum/forum3″ title=”Forum 3″><span>Forum 3</span>

<?php if ( $topics || $stickies ) : ?>

<table id=”latest”>

<tr>

<th><?php _e(‘Topic’); ?> — <?php bb_new_topic_link(); ?></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 bb_topic_labels(); ?> <big>“><?php topic_title(); ?></big></td>

<td class=”num”><?php topic_posts(); ?></td>

<td class=”num”><?php topic_last_poster(); ?></td>

<td class=”num”>“><?php topic_time(); ?></td>

</tr>

<?php endforeach; endif; ?>

<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>

<tr<?php topic_class(); ?>>

<td><?php bb_topic_labels(); ?> “><?php topic_title(); ?><?php topic_page_links(); ?></td>

<td class=”num”><?php topic_posts(); ?></td>

<td class=”num”><?php topic_last_poster(); ?></td>

<td class=”num”>“><?php topic_time(); ?></td>

</tr>

<?php endforeach; endif; ?>

</table>

<div id=”viewdiv”>

<ul id=”views”>

<li class=”view”>” class=”rss-link”><?php _e(‘<abbr title=”Really Simple Syndication”>RSS</abbr> feed for this forum’); ?>

</div>

<div class=”nav”>

<?php forum_pages(); ?>

</div>

<?php endif; ?>

<?php if ( bb_forums( $forum_id ) ) : ?>

<h2><?php _e(‘Subforums’); ?></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”>’ ); ?>“><?php forum_name(); ?><small><?php forum_description(); ?></small><?php bb_forum_pad( ‘</div>’ ); ?></td>

</tr>

<?php continue; endif; ?>

<tr<?php bb_forum_class(); ?>>

<td><?php bb_forum_pad( ‘<div class=”nest”>’ ); ?>“><?php forum_name(); ?><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; ?>

</table>

<?php endif; ?>

<?php post_form(); ?>

</div> <!– End Content –>

<?php bb_get_footer(); ?>

Thanks again sambauers, _CK_ and other mods – you’re doing a great job.

Skip to toolbar