Results 1 to 9 of 9
Like Tree1Likes
  • 1 Post By Andrés Durán Hewitt

template conditionals for various ad networks

This is a discussion on template conditionals for various ad networks within the Ad Networks forums, part of the Monetizing category; Hi, I've been trying to show adsense ads in certain forums and chitika in the rest of them. Here is ...

  1. #1
    Junior Member Endurer's Avatar
    Real Name
    Endurer
    Join Date
    May 2007
    Posts
    28
    Liked
    0 times

    template conditionals for various ad networks

    Hi,

    I've been trying to show adsense ads in certain forums and chitika in the rest of them. Here is the code that I've been trying but it doesn't seem to work:

    Code:
     
    <vb:if condition="in_array($forum['forumid'], array(1,2,3))">
    <div align="center">
    <script type="text/javascript">
    ch_client = "xyz";
    ch_type = "mpu";
    ch_width = 728;
    ch_height = 90;
    ch_non_contextual = 4;
    ch_vertical ="premium";
    ch_sid = "Chitika Premium";
    var ch_queries = new Array( );
    var ch_selected=Math.floor((Math.random()*ch_queries.length));
    if ( ch_selected < ch_queries.length ) {
    ch_query = ch_queries[ch_selected];
    }
    </script>
    <script  src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript">
    </script></div>
     
    <vb:else />
    
    <vb:if condition="in_array($forum['forumid'], array(5,6,7,))">
     
    <div align="center">
    <script type="text/javascript"><!--
    google_ad_client = "xxx";
    google_ad_slot = "xxx";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </div>
    </vb:if>
    </vb:if>
    Any suggestions?

  2. #2
    vBSEO Staff Ace Shattock's Avatar
    Real Name
    Ace Shattock
    Join Date
    Jul 2005
    Location
    Auckland, New Zealand, New Zealand
    Posts
    4,011
    Liked
    13 times
    That looks like vB4. You need to tell us what templates you are trying to show the ads in, and whether $forum is registered for those templates.

    Totally annoying, I know.. to not be able to use that condition in the navbar template was one of the biggest headaches of my time with vB4.

  3. #3
    vBSEO Staff Brian Cummiskey's Avatar
    Real Name
    Brian Cummiskey
    Join Date
    Jul 2009
    Location
    btwn NYC and Boston
    Posts
    12,789
    Liked
    657 times
    Blog Entries
    2
    depending on the page, this sometimes becomes $foruminfo['forumid']

  4. #4
    Junior Member Endurer's Avatar
    Real Name
    Endurer
    Join Date
    May 2007
    Posts
    28
    Liked
    0 times
    Quote Originally Posted by Ace Shattock View Post
    That looks like vB4. You need to tell us what templates you are trying to show the ads in, and whether $forum is registered for those templates.

    Totally annoying, I know.. to not be able to use that condition in the navbar template was one of the biggest headaches of my time with vB4.
    Hi!

    The templates are:

    SHOWTHREAD
    FORUMDISPLAY
    POSTBIT

    How do you register $forum in these templates? Thanks for the help man! Support over at vbulletin.com hasn't been really helpful.

  5. #5
    Member
    Real Name
    Vishal Patel
    Join Date
    May 2007
    Posts
    88
    Liked
    0 times
    I'm trying something similar, I am using <vb:if condition="$forum[forumid] != 4"> ad here <vb:else /> diff ad here </vb:if>

    However, this doesn't seem to work. I am using one of the new Ad Templates, so I'm not sure if $forum is registered here

  6. #6
    vBSEO Staff Ace Shattock's Avatar
    Real Name
    Ace Shattock
    Join Date
    Jul 2005
    Location
    Auckland, New Zealand, New Zealand
    Posts
    4,011
    Liked
    13 times
    Quote Originally Posted by Endurer View Post
    How do you register $forum in these templates? Thanks for the help man! Support over at vbulletin.com hasn't been really helpful.
    That's the thing, I wouldn't have a clue how to register something that should be default. :(

    You could try Brian's suggestion of using foruminfo..

  7. #7
    vBSEO Staff Andrés Durán Hewitt's Avatar
    Real Name
    Andrés Durán
    Join Date
    Jul 2009
    Location
    Costa Rica
    Posts
    3,387
    Liked
    410 times
    Blog Entries
    1
    Hello Vishal,

    Please try:

    <vb:if condition="$GLOBALS['forumid'] != 4"> ad here <vb:else /> dif ad here</vb:if>

    If it doesn't work for you, please let us know what template are you trying to edit.

    Regards.
    Andrés Durán / Crawlability Inc.
    ˇvBSEO 3.6.0 GOLD Liberado!
    Inaugurando el NUEVO vBSEO Sitemap Generator 3.0. - ˇAHORA disponible para Clientes de vBSEO!

    Síguenos en: Facebook | Síguenos en: Twitter


  8. #8
    Junior Member
    Real Name
    DNN Media
    Join Date
    Mar 2011
    Posts
    5
    Liked
    0 times
    Quote Originally Posted by Andrés Durán Hewitt View Post
    Hello Vishal,

    Please try:

    <vb:if condition="$GLOBALS['forumid'] != 4"> ad here <vb:else /> dif ad here</vb:if>

    If it doesn't work for you, please let us know what template are you trying to edit.

    Regards.
    Does that ad code work for showing affiliate banner ads only for certain categories you want it to show for?

  9. #9
    Member
    Real Name
    safakuygur
    Join Date
    Aug 2007
    Posts
    38
    Liked
    0 times
    very nice thanks

Similar Threads

  1. Adsense and conditionals
    By nymyth in forum Ad Networks
    Replies: 1
    Last Post: 10-09-2008, 11:19 AM
  2. Ad networks
    By uaecasher in forum Ad Networks
    Replies: 8
    Last Post: 07-17-2008, 03:42 PM
  3. List of Commonly Used Template Conditionals
    By BamaStangGuy in forum Member Articles
    Replies: 2
    Last Post: 04-26-2008, 06:09 PM
  4. vbSEO & Conditionals
    By Olney in forum General Discussion
    Replies: 5
    Last Post: 02-28-2006, 05:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •