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

Reply
 
Thread Tools Display Modes
  #1  
Old 10-11-2011, 04:08 PM
Marv Marv is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help needed on "$vbulletin->GPC['forumid'] == x"

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:

PHP Code:
<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_useddocument.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.referrerdocument.write ("&amp;referer=" escape(document.referrer));
   if (
document.contextdocument.write ("&context=" escape(document.context));
   if (
document.mmm_fodocument.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=a3c5bfe8'  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_useddocument.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.referrerdocument.write ("&amp;referer=" escape(document.referrer));
   if (
document.contextdocument.write ("&context=" escape(document.context));
   if (
document.mmm_fodocument.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=a30f3c4a'  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
PHP Code:
<vb:if condition="$vbulletin->GPC['forumid'] == 337"
PHP Code:
<vb:if condition="$vbulletin->$forum[forumid] == 337"
and
PHP Code:
<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.
Reply With Quote
  #2  
Old 10-11-2011, 04:11 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Which template is that?
Reply With Quote
  #3  
Old 10-11-2011, 04:15 PM
Marv Marv is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for stopping by. It´s showthread.
Reply With Quote
  #4  
Old 10-11-2011, 04:17 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try checking $thread['forumid'].
Reply With Quote
  #5  
Old 10-11-2011, 04:25 PM
Marv Marv is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

..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:
Reply With Quote
  #6  
Old 10-11-2011, 04:36 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This:

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

Code:
<!-- 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).
Reply With Quote
  #7  
Old 10-11-2011, 05:17 PM
Marv Marv is offline
 
Join Date: Jun 2002
Location: Germany
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 [DATE]1318404439[/DATE] at [TIME]1318404439[/TIME] ---------------

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:
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 07:18 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.04527 seconds
  • Memory Usage 2,260KB
  • Queries Executed 13 (?)
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
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete