PDA

View Full Version : Help needed on "$vbulletin->GPC['forumid'] == x"


Marv
10-11-2011, 04:08 PM
Hi,

I?m trying to add forum-based placements for an AdServer for a use with vbulletin4. Because the placements are outside the built-in AdManager placements I can?t use him.

The code looks like this now:

<vb:if condition="$show['guest']">
<div class="postbit" align="center" style="background: #FFFFFF;">

<vb:if condition="$vbulletin->GPC['forumid'] == 337">
<script type='text/javascript'><!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'https://www.mysite.com/openx/www/delivery/ajs.php':'http://www.mysite.com/openx/www/delivery/ajs.php');
var m3_r = Math.floor(Math.random()*99999999999);
if (!document.MAX_used) document.MAX_used = ',';
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=11");
document.write ('&amp;cb=' + m3_r);
if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
document.write ("&amp;loc=" + escape(window.location));
if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
if (document.context) document.write ("&context=" + escape(document.context));
if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
document.write ("'><\/scr"+"ipt>");
//]]>--></script><noscript><a href='http://www.mysite.com/openx/www/delivery/ck.php?n=a3c5bfe8&amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://www.mysite.com/openx/www/delivery/avw.php?zoneid=11&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;n=a 3c5bfe8' border='0' alt='' /></a></noscript>
</div>
</vb:if>

<vb:elseif>
<script type='text/javascript'><!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'https://www.mysite.com/openx/www/delivery/ajs.php':'http://www.mysite.com/openx/www/delivery/ajs.php');
var m3_r = Math.floor(Math.random()*99999999999);
if (!document.MAX_used) document.MAX_used = ',';
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=2");
document.write ('&amp;cb=' + m3_r);
if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
document.write ("&amp;loc=" + escape(window.location));
if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
if (document.context) document.write ("&context=" + escape(document.context));
if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
document.write ("'><\/scr"+"ipt>");
//]]>--></script><noscript><a href='http://www.mysite.com/openx/www/delivery/ck.php?n=a30f3c4a&amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://www.mysite.com/openx/www/delivery/avw.php?zoneid=2&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;n=a3 0f3c4a' border='0' alt='' /></a></noscript>
</div>
</vb:elseif>
</div>
</vb:if>


As you can see, this should identify the forum I?m in and request the proper ads from the adserver. Unfortunaly, this won?t work. I?ve tested it by now with
<vb:if condition="$vbulletin->GPC['forumid'] == 337">
<vb:if condition="$vbulletin->$forum[forumid] == 337"> and
<vb:if condition="$forum[forumid] == 337">
but nothing worked.

Anyone an idea? Or may be a hint, what I?m doing wrong?
This thingy starts to be pain in the ass :/ Any help would be really appreciated.

kh99
10-11-2011, 04:11 PM
Which template is that?

Marv
10-11-2011, 04:15 PM
Thanks for stopping by. It´s showthread.

kh99
10-11-2011, 04:17 PM
Try checking $thread['forumid'].

Marv
10-11-2011, 04:25 PM
..was a turn & burn.

I?ve tried it as:

<vb:if condition="$vbulletin->$thread['forumid'] == 337">
<vb:if condition="$thread['forumid'] == 337">
<vb:if condition="$vbulletin->$thread[forumid] == 337">
<vb:if condition="$thread[forumid] == 337">

But a nice idea.:up:

kh99
10-11-2011, 04:36 PM
This:

<vb:if condition="$thread[forumid] == 337">


should work, looking at the code. You could try $threadinfo[forumid] instead but it looks like that's just another reference to $thread. (There's no reason to try $vbulletin-> in front of it, that won't work).

Maybe try putting something else inside that <vb:if... just to make sure it's the condition that isn't working, like:

<!-- forumid = {vb:raw thread.forumid} -->
<vb:if condition="$thread[forumid] == 337">
<!-- This is forum 337 -->


Then check the page source for those comments. That also verifies that the forum id is in thread.forumid (or not).

Marv
10-11-2011, 05:17 PM
That was a precious hint, kh. At least I?ve found out, that Andreas? TMS isn?t working proper in my installation. The code won?t get stored by TMS - or to be correct, not all of it. Weired.. I guess I?ll have to take a closer on that first, before continuing.

But thanks so far, kh. Would you mind if I?ld get back to yo after that? Your hints are promising ;)

--------------- Added 1318404439 at 1318404439 ---------------

kh, jfyi:

you were right, the code works. The problem is an assumed problem between Andreas Template Modification System and the on the fly compression run by Darkimmortals vb4: SuperCharged. I removed SuperCharged and everythings fine now.

Thanks for leading the way :up: