Announcement

Collapse
No announcement yet.

Advanced conditionals question.

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

  • Advanced conditionals question.

    I currently have conditionals setup to show my advertisements between the 2nd and 3rd post of each thread. However, I would like to change this, so the advertisement is placed between the last and second to last post of each thread.

    i.e.
    If a thread has one post, no ads are shown.
    If a thread has three posts, ad is placed between 2nd and 3rd post
    If a thread has 100 posts, ad is placed between 99th and 100th post.

    Anyone have an idea how I can do this?
    Bike Forums.net

  • #2
    You could try using the $post[postcount] variable.

    scratch the idea i just wrote, its a variable thing.

    Ill look and see if anything is available in the $post array that might help.

    Comment


    • #3
      i think this is more or less what you want need:
      <if condition="$post[postcount] == $thread[replycount]">

      Comment


      • #4
        Yeh, i just came across that too.


        Code:
        <if condition="$thread['replycount'] == ($post['postcount'] - 1)">ADVERT CODE</if>
        Though, with that method youd add the code to the bottom of the postbit template, not the top.

        Comment


        • #5
          Originally posted by merk
          Yeh, i just came across that too.


          Code:
          <if condition="$thread['replycount'] == ($post['postcount'] - 1)">ADVERT CODE</if>
          Though, with that method youd add the code to the bottom of the postbit template, not the top.
          hmm, i'd have to say i disagee. You don't need the postcount-1 It will display the advert above (or below depending on where you use the conditional) the first post even if there are no replies at all (which goes against the request of "If a thread has one post, no ads are shown.")


          With <if condition="$post[postcount] == $thread[replycount]">, provided the conditional is at the bottom of the postbit template, and of course the reply count of a thread always being -1 of the total posts in the thread, it will always display between the 2nd last and last post, and not at all if there is no replies.
          Last edited by Livingston Dell; Sun 1 Feb '04, 8:15am.

          Comment


          • #6
            Thanks guys! I'll give it a try!
            Bike Forums.net

            Comment


            • #7
              It worked: http://www.vbadmins.com/forums/showp...9&postcount=11
              Bike Forums.net

              Comment


              • #8
                Please post your full code that you used....

                Comment

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