• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Ads under several different posts in thread

#1
Hi,

Within this condition:

Code:
<xen:if is="{$post.position} == 0">
How do I combine several different post position of 0 + 5 + 10 ?(instead of putting 3 rules).

Thanks'.
 

Brogan

XenForo moderator
Staff member
#2
The simplest way is:
Code:
<xen:if is="{$post.position} == 0 OR {$post.position} == 5 OR {$post.position} == 10">
If you want to use an array:
Code:
<xen:if is="in_array({$post.position}, array(0, 5, 10))">
 

Jens1986

Active member
#4
I want an ad in the ad_message_body on the 1st and 2nd post on each page. Currently I use this:

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 OR {$post.position} == 1">
This only works on page 1, on other pages of the thread the ad only shows up in the 1st post. Any way to fix this? @Brogan
 
Last edited:

Jens1986

Active member
#6
Code:
<xen:if is="{$post.position} == 0 OR {$post.position} == 1">
Still only shows on page 1

Edit: this works:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 OR {$post.position} % {$xenOptions.messagesPerPage} == 1">
 
Last edited: