Announcement

Collapse
No announcement yet.

Multiple banner code and template conditionals issue

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

  • Multiple banner code and template conditionals issue

    In some forums I have two banners displaying - the forum specific banner and the default banner, side by side. I cannot find what in my code is causing this. Would someone please have a look?

    <!-- / PAGENAV POPUP -->
    </if>
    <span style="whitespace:nowrap;">
    <if condition="!is_member_of($bbuserinfo, 37)">
    <center>
    <!--diapering-->
    <if condition="in_array($forumid, array(221,349,376,225,224,227))">

    <!-- AdvertisementManager v3.0 code begins -->
    <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=196&dim=468x60&target=_blank" language="Javascript"></script>
    <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=196" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=196&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
    <!-- AdvertisementManager v3.0 code ends -->
    <else />

    <!--natural-->
    <if condition="in_array($forumid, array(311,380,316,347,315,312,379,11))">

    <!-- AdvertisementManager v3.0 code begins -->
    <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=197&dim=468x60&target=_blank" language="Javascript"></script>
    <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=197" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=197&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
    <!-- AdvertisementManager v3.0 code ends -->

    <else />
    <!--parenting-->
    <if condition="in_array($forumid, array(29,35,165,329,333,370,239,157,158,235,159,36,37,32,31,65,34,40,41))">

    <!-- AdvertisementManager v3.0 code begins -->
    <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=198&dim=468x60&target=_blank" language="Javascript"></script>
    <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=198" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=198&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
    <!-- AdvertisementManager v3.0 code ends -->

    <else />


    <!--books-->
    <if condition="in_array($forumid, array(15))">
    <!-- AdvertisementManager v3.0 code begins -->

    <!-- AdvertisementManager v3.0 code begins -->
    <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=204&dim=468x60&target=_blank" language="Javascript"></script>
    <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=204" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=204&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
    <!-- AdvertisementManager v3.0 code ends -->
    <else />

    <!--wahm-->
    <if condition="in_array($forumid, array(181,183,303,304,378,211))">
    <!-- AdvertisementManager v3.0 code begins -->
    <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=195&dim=468x60&target=_blank" language="Javascript"></script>
    <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=195" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=195&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
    <!-- AdvertisementManager v3.0 code ends -->


    <else />

    <!--Canada-->
    <if condition="in_array($forumid, array(94,322))">
    <!-- AdvertisementManager v3.0 code begins -->
    <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=201&dim=468x60&target=_blank" language="Javascript"></script>
    <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=201" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=201&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
    <!-- AdvertisementManager v3.0 code ends -->
    <else />

    <!--bfing-->
    <if condition="in_array($forumid, array(27,310,305,363,25))">
    <!-- AdvertisementManager v3.0 code begins -->
    <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=213&dim=468x60&target=_blank" language="Javascript"></script>
    <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=213" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=213&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
    <!-- AdvertisementManager v3.0 code ends -->
    </else>


    <!-- AdvertisementManager v3.0 code begins -->
    <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=135&dim=468x60&target=_blank" language="Javascript"></script>
    <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=135" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=135&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
    <!-- AdvertisementManager v3.0 code ends -->

    </if></if></if></if></if></if></if></if></center></if></span>
    <br />
    Eat Your Veggies

  • #2
    It becomes increasingly difficult to work with conditionals when they are nested so deep. I recommend using a structure like this:

    Code:
    <if condition="in_array($forumid, array([color=red]X,Y,Z[/color]))">
    	<if condition="in_array($forumid, array([color=red]X[/color]))">
    		[color=blue]X BANNER[/color]
    	</if>
    	<if condition="in_array($forumid, array([color=red]Y[/color]))">
    		[color=blue]Y BANNER[/color]
    	</if>
    	<if condition="in_array($forumid, array([color=red]Z[/color]))">
    		[color=blue]Z BANNER[/color]
    	</if>
    <else />
    	[color=blue]DEFAULT BANNER[/color]
    </if>

    Comment


    • #3
      Thanks for your help Jake. Much appreciated.

      Here's what I placed according to your suggestion:

      <!-- / PAGENAV POPUP -->
      </if>
      <span style="whitespace:nowrap;">
      <if condition="!is_member_of($bbuserinfo, 37)">
      <center>
      <!--diapering-->
      <if condition="in_array($forumid, array(221,349,376,225,224,227))">

      <!-- AdvertisementManager v3.0 code begins -->
      <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=196&dim=468x60&target=_blank" language="Javascript"></script>
      <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=196" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=196&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
      <!-- AdvertisementManager v3.0 code ends -->
      </if>

      <!--natural-->
      <if condition="in_array($forumid, array(311,380,316,347,315,312,379,11))">

      <!-- AdvertisementManager v3.0 code begins -->
      <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=197&dim=468x60&target=_blank" language="Javascript"></script>
      <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=197" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=197&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
      <!-- AdvertisementManager v3.0 code ends -->
      </if>

      <!--parenting-->
      <if condition="in_array($forumid, array(29,35,165,329,333,370,239,157,158,235,159,36,37,32,31,65,34,40,41))">

      <!-- AdvertisementManager v3.0 code begins -->
      <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=198&dim=468x60&target=_blank" language="Javascript"></script>
      <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=198" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=198&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
      <!-- AdvertisementManager v3.0 code ends -->
      </if>


      <!--books-->
      <if condition="in_array($forumid, array(15))">
      <!-- AdvertisementManager v3.0 code begins -->

      <!-- AdvertisementManager v3.0 code begins -->
      <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=204&dim=468x60&target=_blank" language="Javascript"></script>
      <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=204" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=204&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
      <!-- AdvertisementManager v3.0 code ends -->
      </if>

      <!--wahm-->
      <if condition="in_array($forumid, array(181,183,303,304,378,211))">
      <!-- AdvertisementManager v3.0 code begins -->
      <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=195&dim=468x60&target=_blank" language="Javascript"></script>
      <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=195" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=195&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
      <!-- AdvertisementManager v3.0 code ends -->
      </if>

      <!--Canada-->
      <if condition="in_array($forumid, array(94,322))">
      <!-- AdvertisementManager v3.0 code begins -->
      <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=201&dim=468x60&target=_blank" language="Javascript"></script>
      <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=201" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=201&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
      <!-- AdvertisementManager v3.0 code ends -->
      </if>

      <!--bfing-->
      <if condition="in_array($forumid, array(27,310,305,363,25))"><!-- AdvertisementManager v3.0 code begins -->
      <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=201&dim=468x60&target=_blank" language="Javascript"></script>
      <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=201" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=201&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
      <!-- AdvertisementManager v3.0 code ends -->
      </if>

      <!--pregnant-->
      <if condition="in_array($forumid, array(68,178,179,180,19,110,360,249,213,166,20,306,228,21,28,22156,154))">
      <!-- AdvertisementManager v3.0 code begins -->
      <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=201&dim=468x60&target=_blank" language="Javascript"></script>
      <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=201" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=201&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
      <!-- AdvertisementManager v3.0 code ends -->
      </if>

      <!-- AdvertisementManager v3.0 code begins -->
      <script src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image&area=135&dim=468x60&target=_blank" language="Javascript"></script>
      <noscript><a href="http://www.mothering.com/am3-site/cgi/serve.php?req=am_click_s&occ=1&area=135" target="_blank"><img src="http://www.mothering.com/am3-site/cgi/serve.php?req=am_image_s&occ=1&area=135&dim=468x60" alt="Advertisement" border=0 width="468" height="60"></a></noscript>
      <!-- AdvertisementManager v3.0 code ends -->
      </if></center></if></span>
      <br />
      With that code we have some forums displaying two banners side by side - the banner specific for the forum and the general run-of-site banner.

      Our ads types are two:

      1- Forum focus ads, which display in a specific forum category comprised of several forums.

      2 -Run of site, which displays on all forums.

      So how can I set the code upto make that happen?
      Eat Your Veggies

      Comment


      • #4
        I'm sorry I can't follow that code. It is much easier to identify these sorts of problems when the code is properly indented to show what belongs to what, like the example code I gave. If you carefully format your code like this then you can probably see what is going wrong. In my code you can see that specific banners are only considered if the forum is one in the first list, and that the default banner is only shown for forums not in that list.

        Comment


        • #5
          Originally posted by Jake Bunce View Post
          It becomes increasingly difficult to work with conditionals when they are nested so deep. I recommend using a structure like this:

          Code:
          <if condition="in_array($forumid, array([COLOR=red]X,Y,Z[/COLOR]))">
              <if condition="in_array($forumid, array([COLOR=red]X[/COLOR]))">
                  [COLOR=blue]X BANNER[/COLOR]
              </if>
              <if condition="in_array($forumid, array([COLOR=red]Y[/COLOR]))">
                  [COLOR=blue]Y BANNER[/COLOR]
              </if>
              <if condition="in_array($forumid, array([COLOR=red]Z[/COLOR]))">
                  [COLOR=blue]Z BANNER[/COLOR]
              </if>
          <else />
              [COLOR=blue]DEFAULT BANNER[/COLOR]
          </if>
          Thanks Jake, I was looking for this one for so long.
          Desi Friends | Desi Forums
          Bollywood Ringtones | Desi Recipes

          Comment

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