No announcement yet.

How To Hide certain Forums on the forumhome page only

  • Filter
  • Time
  • Show
Clear All
new posts

  • Jake Bunce
    If you have a top level category with a ton of subforums that want to collapse then you can change this method somewhat so you don't have to add a ton of forumids to the phpinclude_start template.

    In the phpinclude_start template, add this code:

    $collapse_cats = array(25, 2);
    In this case the numbers inside parenthesis are the forumids of the parent categories whose subforums you want to hide.

    Now in the forumhome_forumbit_level1_nopost template ONLY, add the red code:

    		<td class="tcat" colspan="<if condition="$vboptions[showmoderatorcolumn]">6<else />5</if>">
    			<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumbit_$forumid')"><img id="collapseimg_forumbit_$forumid" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>
    			<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a>
    			<if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
    			<if condition="$show['subforums']"><div class="smallfont"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
    <if condition="$childforumbits [color=red]AND !in_array($forum['forumid'], $GLOBALS['collapse_cats'])[/color]">
    <tbody id="collapseobj_forumbit_$forumid" style="{$collapseobj_forumid}">
    Now when one of the specified forumids is at the top level (relative to the current) level, all of their subforums will be hidden. You will be able to list the subforums by clicking on the category. This works for top level categories on the forumhome page and forumdisplay pages.

    Leave a comment:

  • How To Hide certain Forums on the forumhome page only

    How do I hide certain forums on the forumhome page only?

    Possible Applications:
    1. Collapse categories on the forumhome page, while leaving other categories of the same depth expanded. This is done by using this method to hide the child forums of a category.
    2. Create a one-way blind for certain forums.
    3. etc...

    Originally posted by Jake Bunce
    First go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> PHP Include Code Templates » -> phpinclude_start

    Add this code to your phpinclude_start template:

    PHP Code:
    $hidden_forums = array(252); 
    The numbers inside the parenthesis are the forumids of the forums and categories you want to hide. Change these numbers appropriately, separating them by commas as shown above.

    Then go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Forum Home Templates »

    Add this code to the top and bottom of each forumhome_forumbit template. For example, here is the forumhome_forumbit_level2_post template. Add the code in red:

    [color=red]<if condition="(THIS_SCRIPT == 'index' AND !in_array($forum['forumid'], $GLOBALS['hidden_forums'])) OR THIS_SCRIPT == 'forumdisplay'">[/color]
    <tr align="center">
    	<td class="alt2"><img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" /></td>
    	<td class="alt1Active" align="$stylevar[left]" id="f$forum[forumid]">
    			<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><strong>$forum[title]</strong></a>
    			<if condition="$show['browsers']"><span class="smallfont">(<phrase 1="$forum[browsers]">$vbphrase[x_viewing]</phrase>)</span></if>
    		<if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
    		<if condition="$show['forumsubscription']"><div class="smallfont"><strong><a href="subscription.php?$session[sessionurl]do=removesubscription&amp;f=$forum[forumid]">$vbphrase[unsubscribe_from_this_forum]</a></strong></div></if>
    		<if condition="$show['subforums']"><div class="smallfont" style="margin-top:$stylevar[cellpadding]px"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
    	<td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
    	<td class="alt1">$forum[threadcount]</td>
    	<td class="alt2">$forum[replycount]</td>
    	<if condition="$vboptions['showmoderatorcolumn']">
    	<td class="alt1"><div class="smallfont">$forum[moderators]&nbsp;</div></td>
    If you ever add a new forum that you want to be hidden then you need to add its forumid to the exclusion list in your phpinclude_start template.
    Last edited by Jake Bunce; Fri 21 May '04, 2:34pm.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.