Announcement

Collapse
No announcement yet.

conditional ads

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

  • conditional ads

    so, what i'm trying to do, is show an ad every 7 posts.
    HTML Code:
    <if condition="$post[postcount] % 7 == 0">


    our forum has the default configuration of showing 15 posts per page, so this starts to get the number off track, so, i was considering switching it to 16, and just after every 8th post. But what i'm wondering is, is there a way to do just have it do 7 posts down from the 1st post on the page?

    Also, is there some good documentation on displaying certain things based on post number?
    Last edited by sorahn@gmail.com; Fri 21st Apr '06, 10:04pm.

  • #2
    This is the only documentation we have on displaying things based on the post count: http://www.vbulletin.com/forum/showthread.php?t=157022

    Try using this code though:
    HTML Code:
    <if condition="($post[postcount]-1) % 7 == 0">
    Best Regards
    Colin Frei

    Please don't contact me per PM.

    Comment


    • #3
      that put an ad after post 1, 8, 15, 22... etc. i'm thinking the best way would be to set the forum to 16 posts per page, and then just do multiples of 8

      Comment


      • #4
        ok, i take it back, i seem to have somewhat of a system working.

        HTML Code:
        <if condition="(($post[postcount] % $vboptions[maxposts] == 7) and ($post[postcount] >= 10))">
             <!-- show after the 7th ad down, if there are more then 10 posts -->
        <else>
            <if condition="($post[islastshown] and !$GLOBALS['vbulletin']->GPC['ajax'] and $post[postcount] >= 3)">
                <!-- this should show it at the end if there are more then 3 posts, but it's broken -->
             </if>
        </if>
        i'm close, but i'm not sure what's messed up.

        Comment


        • #5
          sorry to spam my own thread, but after looking through that link, i came up with this, and as far as i can tell, it works.

          HTML Code:
          <if condition="( ( ( $post[postcount] % $vboptions[maxposts] == 7 ) or ( ( $post[islastshown] ) and (
          !$GLOBALS['vbulletin']->GPC['ajax'] ) ) and ( $vboptions[maxposts] >= 10 ) ) )">
              <!-- Adcode after 7th and last posts if >= 10 -->
          <else />
              <if condition=" ( ( ( $post[islastshown] ) and ( !$GLOBALS['vbulletin']->GPC['ajax'] ) ) and (
          $vboptions[maxposts] >= 3 ) )">
              <!-- Adcode in last if > 3 and < 10 -->
              </if>
          </if>
          woot!

          i'm sure there's a way to cramp that all the way down into 1 if statement, but thats too many parenthesis for me.

          Comment

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