Announcement

Collapse
No announcement yet.

Conditionals Question

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

  • Conditionals Question

    Hello,

    Thanks for your time.

    So I've added adsense to my forum, reading across the TOS I cannot show advertisements on the registrations page, nor do I want them there anyhow to be honest. So I've searched the forum and come across the code which sets a condition to show the adds on certain sections. Below is my original code...

    Code:
    <if condition="!$bbuserinfo[userid]"><center>
    <script type="text/javascript"><!--
    google_ad_client = "pub-3421768417186957";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text_image";
    google_ad_channel ="";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "666458";
    google_color_url = "A39F8B";
    google_color_text = "000000";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    <br>
    <a href="http://www.domain.com/board/register.php?">Register</a> to remove these ads!</center></if>
    Now, here is where I'm struggiling. So I've added the condition to only show the ads to guests. Now, adding another condition to show the ads on my index, showthread and forum display is another matter. I honestly haven't a clue where to add the other conditional. I've tried doing the below...

    Code:
    <if condition="!$bbuserinfo[userid]" this_page == 'showthread' or this_page == 'index' or this_page == 'forumdisplay'">
    No luck. It's obviously the wrong way to add another condition. Could anyone possibly put me in the right direction here and clear my error of ways? Thanks again!

    Chris

  • #2
    Try this:

    Code:
    <if condition="!$bbuserinfo[userid]" AND (this_page == 'showthread' OR this_page == 'index' OR this_page == 'forumdisplay')">
    MGM out

    Comment


    • #3
      I'm afraid that didn't work either. There must be away to run two conditionals without creating an error. Thanks for trying MGM, much appreciated.

      Anyone else have a little insight into this?

      Comment


      • #4
        Try using THIS_SCRIPT
        Also, keep it uppercase.

        For the lazies:
        Code:
        <if condition="!$bbuserinfo[userid]" AND (THIS_SCRIPT == 'showthread' OR THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')">
        Best Regards
        Colin Frei

        Please don't contact me per PM.

        Comment


        • #5
          That didn't work either...

          Code:
          <if condition="!$bbuserinfo[userid]" AND (THIS_SCRIPT == 'showthread' OR THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')"><center>
          <script type="text/javascript"><!--
          google_ad_client = "pub-3421768417186957";
          google_ad_width = 468;
          google_ad_height = 60;
          google_ad_format = "468x60_as";
          google_ad_type = "text_image";
          google_ad_channel ="";
          google_color_border = "FFFFFF";
          google_color_bg = "FFFFFF";
          google_color_link = "285173";
          google_color_url = "6593CC";
          google_color_text = "000000";
          //--></script>
          <script type="text/javascript"
            src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
          </script>
          <br>
          <a href="http://www.wrasslinboard.com/board/register.php?">Register</a> to remove these ads!</center></if>
          Leading to this error...

          The following error occurred when attempting to evaluate this template:

          Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/wrasslin/public_html/board/includes/adminfunctions_template.php(3096) : eval()'d code on line 204

          This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
          I've gone through all the above code and cannot see any problems with it unless the conditions are wrong, I'm not doubting your knoledge or anything there though. I appreciate you even taking the time to help.

          Hopefully trial and error will lead to success...

          Comment


          • #6
            Try the following:

            Code:
            <if condition="!$bbuserinfo[userid] AND (THIS_SCRIPT == 'showthread' OR THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')"><center>
            <script type="text/javascript"><!--
            google_ad_client = "pub-3421768417186957";
            google_ad_width = 468;
            google_ad_height = 60;
            google_ad_format = "468x60_as";
            google_ad_type = "text_image";
            google_ad_channel ="";
            google_color_border = "FFFFFF";
            google_color_bg = "FFFFFF";
            google_color_link = "285173";
            google_color_url = "6593CC";
            google_color_text = "000000";
            //--></script>
            <script type="text/javascript"
              src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
            </script>
            <br>
            <a href="http://www.wrasslinboard.com/board/register.php?">Register</a> to remove these ads!</center></if>
            Best Regards
            Colin Frei

            Please don't contact me per PM.

            Comment


            • #7
              Wow, that worked. I can't thank you enough Colin.

              Looking through your piece of code and the one I quoted, what's the diffrence? Oh oh wait, I see! You removed the ", right? Gah, it's all sorted now anyhow thanks to your good self.

              Comment


              • #8
                Exactly... missed the " the first three times of looking over it too
                Best Regards
                Colin Frei

                Please don't contact me per PM.

                Comment


                • #9
                  Similar question: How to exclude google adsense based on files: register, online, usercp ?

                  Would this work?

                  <if condition="THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'register' OR THIS_SCRIPT == 'usercp'">
                  </else>
                  <!----google adsense--->)
                  </if>
                  Fan Club member for VBulletin Dev and Support Team ;)

                  Hysterectomy - GirlsGetGoing.com - Fabulous Fifty

                  I'm frequently asked about the skin designer for my forums. ForumSkin.com

                  Comment


                  • #10
                    Technically yes, allthough you could use the following to make it a bit easier:
                    Code:
                    <if condition="THIS_SCRIPT != 'online' AND THIS_SCRIPT != 'register' AND THIS_SCRIPT != 'usercp'">
                    <!----google adsense--->)
                     </if>
                    I also didn't check the THIS_SCRIPT values.
                    Best Regards
                    Colin Frei

                    Please don't contact me per PM.

                    Comment


                    • #11
                      Originally posted by Colin F View Post
                      Technically yes, allthough you could use the following to make it a bit easier:
                      Code:
                      <if condition="THIS_SCRIPT != 'online' AND THIS_SCRIPT != 'register' AND THIS_SCRIPT != 'usercp'">
                      <!----google adsense--->)
                       </if>
                      I also didn't check the THIS_SCRIPT values.
                      How would i add a conditional for certain usergroups to view the adsense with the following code you posted? Thanks

                      Comment


                      • #12
                        Try this:
                        <if condition="THIS_SCRIPT != 'online' AND THIS_SCRIPT != 'register' AND THIS_SCRIPT != 'usercp' AND is_member_of($bbuserinfo, X,Y,Z)">

                        Replace X, Y and Z with the usergroupids.
                        Best Regards
                        Colin Frei

                        Please don't contact me per PM.

                        Comment

                        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                        Working...
                        X