Announcement

Collapse
No announcement yet.

Help needed on "$vbulletin->GPC['forumid'] == x">

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help needed on "$vbulletin->GPC['forumid'] == x">

    Hi,

    Im 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 cant use him.

    The code for showthread 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'><!--//<=!=[=C=D=A=T=A=[
       
    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'><!--//<=!=[=C=D=A=T=A=[
       
    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 Im in and request the proper ads from the adserver. Unfortunaly, this wont work. Ive 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 Im doing wrong?
    This thingy starts to be pain in the ass :/ Any help would be really appreciated.
    Last edited by Marv; Tue 11th Oct '11, 9:15am.
    Regards,
    Marv


    'My world, the one that I live in, that surrounds me, is called insane by some. I can dig that - I feel the same about theirs.'
    (Henry Rollins)

  • #2
    Where are you using this conditional?
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud customization and demonstration site.
    vBulletin 5 Documentation - Updated every Friday. Report issues here.
    vBulletin 5 API - Full / Mobile
    I am not currently available for vB Messenger Chats.

    Comment


    • #3
      If this is in the SHOWTHREAD template, then use the variable "$thread['forumid']

      Please don't PM or VM me for support - I only help out in the threads.
      vBulletin Manual & vBulletin 4.0 Code Documentation (API)
      Want help modifying your vbulletin forum? Head on over to vbulletin.org
      If I post CSS and you don't know where it goes, throw it into the additional.css template.

      W3Schools &lt;- awesome site for html/css help

      Comment


      • #4
        Hi Lynne,

        thanks for helping me out. May be youve already noticed, that Ive posted this problem over at vb.org, too. kh99 was so nice to help me get on the right track. The problem is an assumed problem between Andreas Template Modification System and the on the fly compression run by Darkimmortals vb4: SuperCharged, that resulted in an incomplete and therefore corrupted storage of the code in the db. Im not sure, wether Darkimmortals Mod has an active part in rewriting or compressing the code while hes been written to the db or if its a asynchron/indirect interrupt while the db-storage. But I simply removed SuperCharged and everythings fine now. Even my server is running with less load now - may be Ive misconfigurated vb4: SuperCharged or it interferes with TMS by design. Dunno.

        Anyway, thank you all for your helping hand Click image for larger version

Name:	up.gif
Views:	1
Size:	1,023 Bytes
ID:	3685648
        Regards,
        Marv


        'My world, the one that I live in, that surrounds me, is called insane by some. I can dig that - I feel the same about theirs.'
        (Henry Rollins)

        Comment


        • #5
          Glad you got it worked out.

          Please don't PM or VM me for support - I only help out in the threads.
          vBulletin Manual & vBulletin 4.0 Code Documentation (API)
          Want help modifying your vbulletin forum? Head on over to vbulletin.org
          If I post CSS and you don't know where it goes, throw it into the additional.css template.

          W3Schools &lt;- awesome site for html/css help

          Comment


          • #6
            Solved one, got another issue for free - so Im back on the map. May be someone of you can help me out with another problem I run into:

            I try to implement AdChannels into the first post ads via the AdManager. Looked as it could be done nice and clean..you know..the quick and lazy way by using if else statements in the Admanager:

            PHP Code:
            <vb:if condition="in_array($thread['forumid'], array(1,2,3,4,5))">

            <
            vb:if condition="in_array($thread['forumid'], array(2,5))">
            blubb
            </vb:if>

            <
            vb:if condition="in_array($thread['forumid'], array(1,3,4))">
            blubb
            </vb:if>

            <
            vb:else />
            blubber
            </vb:if> 
            Unfortunal, this wont work for me. Anyone an idea what Ive done wrong? As far as the descreption reads "Template conditionals and common available variables of vBulletin allowed".
            Last edited by Marv; Thu 20th Oct '11, 12:12pm.
            Regards,
            Marv


            'My world, the one that I live in, that surrounds me, is called insane by some. I can dig that - I feel the same about theirs.'
            (Henry Rollins)

            Comment


            • #7
              What is the output you're getting? And what were you expecting to get?
              Translations provided by Google.

              Wayne Luke
              The Rabid Badger - a vBulletin Cloud customization and demonstration site.
              vBulletin 5 Documentation - Updated every Friday. Report issues here.
              vBulletin 5 API - Full / Mobile
              I am not currently available for vB Messenger Chats.

              Comment


              • #8
                Hi Wayne,
                thanks for the reply.

                I expected (located in forumid=1,2,3,4,5 ) = "blubb" but Ive got "blubber". So the if array has been ignored and vbelse was displayed. Makes me wonder wether if statements really work in the AdManager or not. Did I miss something?
                Regards,
                Marv


                'My world, the one that I live in, that surrounds me, is called insane by some. I can dig that - I feel the same about theirs.'
                (Henry Rollins)

                Comment


                • #9
                  Which ad location are you using? I am not sure your variable will be available.
                  Translations provided by Google.

                  Wayne Luke
                  The Rabid Badger - a vBulletin Cloud customization and demonstration site.
                  vBulletin 5 Documentation - Updated every Friday. Report issues here.
                  vBulletin 5 API - Full / Mobile
                  I am not currently available for vB Messenger Chats.

                  Comment


                  • #10
                    Ah, one step closer. Its ad_location=thread_first_post_content&ad_location_orig=thread_first_post_content . In other words: first post in showthread. I am using the same code and variables for the problem I started this thread with and it works great.
                    Last edited by Marv; Thu 20th Oct '11, 12:27pm.
                    Regards,
                    Marv


                    'My world, the one that I live in, that surrounds me, is called insane by some. I can dig that - I feel the same about theirs.'
                    (Henry Rollins)

                    Comment


                    • #11
                      Guess Ill need a workaround for that. Anyone an idea?
                      Regards,
                      Marv


                      'My world, the one that I live in, that surrounds me, is called insane by some. I can dig that - I feel the same about theirs.'
                      (Henry Rollins)

                      Comment


                      • #12
                        Try using $GLOBALS['forumid']

                        Please don't PM or VM me for support - I only help out in the threads.
                        vBulletin Manual & vBulletin 4.0 Code Documentation (API)
                        Want help modifying your vbulletin forum? Head on over to vbulletin.org
                        If I post CSS and you don't know where it goes, throw it into the additional.css template.

                        W3Schools &lt;- awesome site for html/css help

                        Comment


                        • #13
                          Aww...you must be kiddin...?!

                          ..oO(Ill bit my ass when....grr)
                          Regards,
                          Marv


                          'My world, the one that I live in, that surrounds me, is called insane by some. I can dig that - I feel the same about theirs.'
                          (Henry Rollins)

                          Comment


                          • #14
                            Lynne,

                            with all due to respect: now I hate you... - for facing me my own dumbness.
                            THANK YOU so much !

                            Regards,
                            Marv


                            'My world, the one that I live in, that surrounds me, is called insane by some. I can dig that - I feel the same about theirs.'
                            (Henry Rollins)

                            Comment

                            Loading...
                            Working...
                            X