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 12-27-2009, 06:17 PM
kall's Avatar
kall kall is offline
 
Join Date: Apr 2004
Location: New Zealand
Posts: 2,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default threadid conditional - Not working the same?

Scenario: I want to display ads on all showthread pages (preferably in postbit), with specific ads for specific threads, and general ads for the rest.

In vB3, this was a matter of using this code wherever the ad was, and it would replace the generic ad with the specified one.

PHP Code:
<if condition="$thread['threadid'] == '12345'">Specific Ad for Thread #12345
<else/>
Generic Ad
</if> 
Now, using the new syntax below, the threadid condition is never true, no matter what template I stick it in:
PHP Code:
<vb:if condition="$thread['threadid'] == '12345'">Specific Ad for Thread #12345
<vb:else/>
Generic Ad
</vb:if> 
I've tried $thread['threadid'], $threadinfo['threadid'], $post['threadid'], and all without the '' inside the []. I'm beginning to lose it. Please help.
Reply With Quote
  #2  
Old 12-27-2009, 06:47 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It should be <vb:else /> not <vb:else/> Other than that, I don't see anything wrong.
Reply With Quote
  #3  
Old 12-27-2009, 07:11 PM
kall's Avatar
kall kall is offline
 
Join Date: Apr 2004
Location: New Zealand
Posts: 2,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ahh.

Thanks Lynne.

Should it work in ad_global_below_navbar? If not, what variable am I meant to be checking for if I want to use that template?
Reply With Quote
  #4  
Old 12-27-2009, 09:07 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I really don't know as I never use the ad templates.
Reply With Quote
  #5  
Old 12-27-2009, 10:28 PM
kall's Avatar
kall kall is offline
 
Join Date: Apr 2004
Location: New Zealand
Posts: 2,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK.. replace that template name with 'navbar' then.
Reply With Quote
  #6  
Old 12-28-2009, 03:52 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you look at the functions.php page where the navbar is rendered, the thread variable is not registered. So, you would have to preregister it if you want to use it there.
Reply With Quote
  #7  
Old 12-28-2009, 05:47 AM
kall's Avatar
kall kall is offline
 
Join Date: Apr 2004
Location: New Zealand
Posts: 2,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any chance you can help with that?

I can preregister my own custom variables, but preregistering $threadid for use on showthread.php seems to be difficult.
Reply With Quote
  #8  
Old 12-28-2009, 02:19 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would guess something like this:
PHP Code:
vB_Template::preRegister('navbar', array('thread => $thread)); 
Take a look in the code for where the navbar is rendered and make sure you pick a hook location that is executed before that.
Reply With Quote
  #9  
Old 03-30-2010, 10:41 AM
tintin74 tintin74 is offline
 
Join Date: Jul 2007
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello, I'm running vb 3.7 and I've used this code to display specific ads for specific thread:

Code:
<if condition="$thread['threadid'] == '12345'">Specific Ad for Thread #12345
<else/>
Generic Ad
</if>
but if I use this conditional into the SHOWTHREAD template everything works well.

I need to get work thi conditional into a custom template called by SHOWTHREAD template,

so I've inserted into SHOWTHREAD template this:

PHP Code:
 $specads 
, I've create the "showthread_specads" custom template,

and this plugin:

Product:Vbulletin
Name: showthread_specads
Code:
Quote:
eval('$specads = "' . fetch_template('showthread_specads') . '";');
My custom template is called normally by showthread but if I insert into it the same conditional I've used for SHOWTHREAD template, the conditional don't work .

I suppose there 's something to change here :

Code:
<if condition="$thread['threadid'] == '12345'">Specific Ad for Thread #12345
<else/>
Generic Ad
</if>
but I don't know what.

Does anyone could help me ,please?
Reply With Quote
  #10  
Old 03-30-2010, 01:32 PM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

HTML Code:
<vb:if condition="$threadinfo['threadid'] == '12345'">
Specific Ad for Thread #12345
<vb:else />
Generic Ad
</vb:if>
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 09:04 AM.


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.04338 seconds
  • Memory Usage 2,261KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (1)bbcode_html
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete