vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Design and Graphics Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=253)
-   -   threadid conditional - Not working the same? (https://vborg.vbsupport.ru/showthread.php?t=231350)

kall 12-27-2009 06:17 PM

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.

Lynne 12-27-2009 06:47 PM

It should be <vb:else /> not <vb:else/> Other than that, I don't see anything wrong.

kall 12-27-2009 07:11 PM

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?

Lynne 12-27-2009 09:07 PM

I really don't know as I never use the ad templates.

kall 12-27-2009 10:28 PM

OK.. replace that template name with 'navbar' then. :)

Lynne 12-28-2009 03:52 AM

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.

kall 12-28-2009 05:47 AM

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.

Lynne 12-28-2009 02:19 PM

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.

tintin74 03-30-2010 10:41 AM

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?

ForumsMods 03-30-2010 01:32 PM

HTML Code:

<vb:if condition="$threadinfo['threadid'] == '12345'">
Specific Ad for Thread #12345
<vb:else />
Generic Ad
</vb:if>



All times are GMT. The time now is 04:46 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.01012 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_html_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete