View Full Version : Forum Block in single Forum
invitezone
10-03-2012, 06:44 PM
Hi all,
I am trying to add a forum block that I want to display only in one of my subforums.
I am using it to create a menu that relates only to that single sub forum.
Any advice on how I could achieve this?
Thank you all for your usual helpfulness.
invitezone
10-06-2012, 12:57 PM
anyone got any infor on doing this please?
ForceHSS
10-06-2012, 01:21 PM
have you done a search for a plugin for it
Are you creating a "Custom HTML/PHP" forum block? You can try this: Go to the style manager and copy the code of the "block_html" template, then create a new template and paste the code and surround it with an if, like this:
<vb:if condition="$GLOBALS['forumid'] == X">
// code from block_html goes here
</vb:if>
(of course you'll replace X with your forumid).
Then at the bottom of forum block configuration page there's a "Template to Use" field. You can put the name of your new template there.
invitezone
10-07-2012, 07:53 PM
have you done a search for a plugin for it
basic starting point, so yes of course I have...
Are you creating a "Custom HTML/PHP" forum block? You can try this: Go to the style manager and copy the code of the "block_html" template, then create a new template and paste the code and surround it with an if, like this:
<vb:if contents="$GLOBALS['forumid'] == X'>
// code from block_html goes here
</vb:if>
(of course you'll replace X with your forumid).
Then at the bottom of forum block configuration page there's a "Template to Use" field. You can put the name of your new template there.
Excellent just the kind of info I was after. Really appreciate the help, I will give that a try.
Thanks again ;)
invitezone
10-21-2012, 11:53 AM
ok so I tried this, but when I save the new template i get this error...
The following error occurred when attempting to evaluate this template:
Parse error: syntax error, unexpected ')' in /home/digitale/public_html/includes/adminfunctions_template.php(5432) : eval()'d code on line 1
This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
Here is the template that im trying to save...
<vb:if contents="$GLOBALS['forumid'] == 156'>
<li>
<div class="block smaller">
<div class="blocksubhead">
<a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
<span class="blocktitle">{vb:raw blockinfo.title}</span>
</div>
<div class="widget_content blockbody floatcontainer">
<div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
{vb:raw content}
</div>
</div>
</div>
<div class="underblock"></div>
</li>
</vb:if>
That's my fault, there's a mistake in the code I posted. The first line should be:
<vb:if condition="$GLOBALS['forumid'] == 156">
Sorry.
invitezone
10-21-2012, 02:01 PM
appreciate the help buddy,
I'll go try it out and let you know how it goes :)
--------------- Added 1350831890 at 1350831890 ---------------
same issue
<vb:if contents="$GLOBALS['forumid'] == 156">
<li>
<div class="block smaller">
<div class="blocksubhead">
<a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
<span class="blocktitle">{vb:raw blockinfo.title}</span>
</div>
<div class="widget_content blockbody floatcontainer">
<div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
{vb:raw content}
</div>
</div>
</div>
<div class="underblock"></div>
</li>
</vb:if>
Oh, yeah - it's "condition", not "contents":
<vb:if condition="$GLOBALS['forumid'] == 156">
I have no idea what I was thinking that day.
invitezone
10-21-2012, 02:21 PM
well it has accepted it now, but nothing shows up in my forumid 156
Oh. You know, I'm being stupid. The forum blocks normally only ever show up on the forumhome page, so this doesn't make any sense unless you have a mod that allows the sidebar on other pages. I think there is more than one mod that does that though.
Sorry, I guess ForceHSS's suggestion was right and I just wasted your time.
Edit: Here's one: www.vbulletin.org/forum/showthread.php?t=233871 and that one seems to have an option for displaying block only on certain forums, so you don't need to do the template thing I suggested.
invitezone
10-21-2012, 02:53 PM
LOL!!
ok thanks for the help anyway :p
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.