Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Design and Graphics Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-18-2011, 04:38 PM
GCC LLC GCC LLC is offline
 
Join Date: Oct 2005
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default forumid conditional help in templates please?

I'm trying to edit my forumhome_lastpostby template to display a banner only for a certain forumid. Here's the conditional I'm using, which is not working. Any help is appreciated:

<vb:if condition="$forum['forumid'] == 38">
<div style="float:right;">banner here</div>
</vb:if>

I've also tried $foruminfo['forumid'], and I've even tried making a plugin to register a new variable and then using that in the conditional as follows:

$thisforumid = $forum['forumid'];
vB_Template:reRegister('forumhome_lastpostby',ar ray('thisforumid' => $thisforumid));

Any suggestions? This was so easy in vb3, crazy how it's so difficult (or I'm just missing something terribly easy) in vB4.

Thanks in advance!
Reply With Quote
  #2  
Old 06-18-2011, 07:21 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For that template, I would try the variable $threadinfo instead of $forum.
Reply With Quote
  #3  
Old 06-18-2011, 08:41 PM
GCC LLC GCC LLC is offline
 
Join Date: Oct 2005
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
For that template, I would try the variable $threadinfo instead of $forum.
Nothing still shows up using $threadinfo. I tried it both of the following ways:

1) Placing $threadinfo['forumid'] directly in the conditional:
<vb:if condition="$threadinfo['forumid'] == 38">
<br /><br />
<div style="float:right;">banner here</div>
<br /><br />
</vb:if>

2) Creating a plugin to register the variable $thisforumid and then placing that in the forumhome_lastpostby template:

Plugin:
$thisforumid = $threadinfo['forumid'];
vB_Template:reRegister('forumhome_lastpostby',ar ray('thisforumid' =>
$thisforumid));

Template:

<vb:if condition="$thisforumid == 38">
<br /><br />
<div style="float:right;">banner here</div>
<br /><br />
</vb:if>

For what it's worth, forumid 38 is the parent forum and there are several subforums below it. I'm assuming that the parent forum ID I need to use here, as that's how it's cycling through on FORUMHOME to show all of the forums. I have, however, also tried putting both the parent and subforum ID's all in an in_array conditional as well - which also didn't work. Screenshot is attached here for review.
Attached Images
File Type: jpg vb_screenshot.jpg (18.8 KB, 0 views)
Reply With Quote
  #4  
Old 06-18-2011, 08:46 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try $lastpostinfo instead of $threadinfo or $forum.
Reply With Quote
  #5  
Old 06-18-2011, 09:09 PM
GCC LLC GCC LLC is offline
 
Join Date: Oct 2005
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, just a quick update...I changed the plugin to this:

$thisforumid = $forum['forumid'];
vB_Template:reRegister('forumhome_lastpostby',arra y('thisforumid' =>
$thisforumid));

Then, I moved the hook location for the plugin to forumbit_display and now the variable $thisforumid is available and displays within FORUMHOME in the correct place...

The problem is - it displays the forumid in the forum below where it's supposed to be.

For example, the lastpostby area does not show anything for the first forum. However, in the lastpostby area for the SECOND forum, it shows the forumid of the FIRST forum. In the 3rd forum, it shows the forumid of the second forum, etc. until the end of the list.

Does that help shed any light on things? Maybe with combined brains, we can figure this out.

--------------- Added [DATE]1308435240[/DATE] at [TIME]1308435240[/TIME] ---------------

Just tried that too, Boofo..

<vb:if condition="$lastpostinfo['forumid'] == 38">
<br /><br />
<div style="float:right;">forum 38 banner here</div>
<br /><br />
</vb:if>

Nothing shows up when I do that, either unfortunately.
Reply With Quote
  #6  
Old 06-18-2011, 10:08 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is what I use at the very top of my forumhome_lastpostby template and it works fine. You need the else. Also add </vb:if> to the very bottom of the template.

Code:
<vb:if condition="$lastpostinfo['forumid'] == '36'">
	<div>&nbsp;</div>
	<div style="text-align: center;">
	VIP Forum
	</div>
<vb:else />
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:17 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04883 seconds
  • Memory Usage 2,233KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (1)postbit_attachment
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete