IPB Conditional Needed

Discussion in 'Invision Power Services' started by Michael, Sep 2, 2010.

  1. AdEx Fan

    Michael Well-Known Member

    Likes Received:
    76
    Software You Use:
    XenForo
    Does anyone know a conditional I could use that will display x info after every x posts or after the first post in a thread? I really need this so I can display some info within threads for guests.

    Any ideas?

    Thank you :wink:
  2. Michael McCune Junior Member

    Likes Received:
    8
    The variable $post['post']['post_count'] in the topicViewTemplate holds the value of which post in the topic that particular post is. So to have something show up after the first post, you'd have a conditional like this:

    Code:
    <if test="$post['post']['post_count'] == 1">
    show something
    </if>
    To have something repeat after X number of posts, do this:

    Code:
    <if test="$post['post']['post_count'] % X == 0">
    show something
    </if>
    Just replace X with the number of posts you want to show before doing this. And remember, this code goes into the topicViewTemplate right before the first </foreach> tag, as that's where it does the loop over each post to show.
  3. AdEx Fan

    Michael Well-Known Member

    Likes Received:
    76
    Software You Use:
    XenForo
    Thanks for those Michael, do you know of any list containing commonly wanted ones thats available anywhere?
  4. Michael McCune Junior Member

    Likes Received:
    8
    There are thousands of possible such conditionals, there isn't any complete list.

Share This Page