vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=231350

threadid conditional - Not working the same?
by kall
27 Dec 2009 19:17

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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now, using the new syntax below, the threadid condition is never true, no matter what template I stick it in:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I've tried $thread['threadid'], $threadinfo['threadid'], $post['threadid'], and all without the '' inside the []. I'm beginning to lose it. Please help.

Lynne 27 Dec 2009 19:47

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

kall 27 Dec 2009 20:11

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 27 Dec 2009 22:07

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

kall 27 Dec 2009 23:28

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

Lynne 28 Dec 2009 04:52

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 28 Dec 2009 06:47

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 28 Dec 2009 15:19

I would guess something like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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 30 Mar 2010 11:41

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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

, 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 :


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

but I don't know what.

Does anyone could help me ,please?

ForumsMods 30 Mar 2010 14:32


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


tintin74 30 Mar 2010 15:36

Hello , vB Style,

I think this sintax <vb:if> </vb:if> works for vb4.0 version.

But the rest is OK!

Thank you very much! :up:

ForumsMods 30 Mar 2010 22:14

Yes, this forums is for vB 4, hehe.

prawn_86 26 Aug 2012 03:31

I am having the same issue. Have just upgraded to VB4 and am trying to put the following code into the ad_showthread_firstpost template:

<vb:if condition="$thread['threadid'] == 87">
<center>

<b>This thread is brought to you by:</b>
<br>
<center>
<a href="http://..../
" target="_blank">wording here
</a>
</center>
<br>
</vb:if>


Can anyone see what i am doing wrong?

Lynne 26 Aug 2012 03:36

Is the $thread variable registered for use in that template? Try using $GLOBALS instead.

prawn_86 26 Aug 2012 03:43

Quote:

Originally Posted by Lynne (Post 2360034)
Is the $thread variable registered for use in that template? Try using $GLOBALS instead.

Sorry Lynne i am very green at this, do i replace $thread with $GLOBALS and leave the rest?

I have tryied a few different variations on your suggestion but still cannot get it working

--------------- Added 26 Aug 2012 at 04:13 ---------------

Just as a side note, putting the code into the ad_showthread_firstpost_start template works when i replace thread with global.

I still can't figure out how to get it showing between the 1st and 2nd post on each page


All times are GMT. The time now is 03:46.

Powered by vBulletin® Version 3.8.12
Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.