hello everyone,

Right i have posted this in the phpbb support forums and have not had a reply yet.

What i am wanting to do is disply the forum names, and the ammount of topics in that forum on EVERY page in the forum. So it would look like this

FORUM NAME (98)

(98) Being the number of topics in that forum.

Now i have actualy got the forumnames displaying on EVERY page, but i cant figure out how id get the ammount of topics in there.

I am putting this code into the page_header.php page, here is the code i have used

PHP Code:
$sql "SELECT c.cat_id, c.cat_title, c.cat_order
   FROM " 
CATEGORIES_TABLE " c
   ORDER BY c.cat_order"
;
if( !(
$result $db->sql_query($sql)) )
{
   
message_die(GENERAL_ERROR'Could not query categories list'''__LINE____FILE__$sql);
}
$category_rows = array();

while( 
$category_rows[] = $db->sql_fetchrow($result) );

for(
$x=0;$x<(count($category_rows)-1);$x++)
{
    
$template->assign_block_vars('switch_show_sidebar', array(
            
'ID' => $category_rows[$x][0],
            
'TITLE' => $category_rows[$x][1],
            
'ROW_COLOR' => 'row1'
            
));
            
$sql2 "SELECT forum_id, forum_name
           FROM " 
FORUMS_TABLE "
            WHERE  cat_id = '"
.$category_rows[$x][0]."' ORDER BY forum_order";

                if( !(
$result2 $db->sql_query($sql2)) )
                {
                   
message_die(GENERAL_ERROR'Could not query categories list'''__LINE____FILE__$sql2);
                }
                
$category_rows_forums = array();
                while( 
$category_rows_forums[] = $db->sql_fetchrow($result2) );

                for(
$y=0;$y<(count($category_rows_forums)-1);$y++)
                {
                    
$template->assign_block_vars('switch_show_sidebar.switch_show_sidebar_forums', array(
                            
'ID' => $category_rows_forums[$y][0],
                            
'TITLE' => '<a href="'.append_sid('viewforum.'.$phpEx.'?f='.$category_rows_forums[$y][0].'').'" class="mainmenu">'.$category_rows_forums[$y][1].'</a>',
                            
'ROW_COLOR' => 'row2'
                            
));


                }
                
$db->sql_freeresult($result2);
}
$db->sql_freeresult($result); 
Thanks in advance
Chris