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

XF 1.1 <xen:if is="{$post.position} == 0"> in Conversation ?

A

account8226

Guest
#1
Hello, I am adding adds on my forum, but I would like only on the first post of a thread.

It's working in topic, but not working in conversation, the add occur on every single message.

Any idea to fix it ? Here is my code.

PHP:
<xen:hook name="ad_message_body" />
 
<xen:if is="!{xen:helper ismemberof, $visitor, 9}">
 
<xen:if is="{$post.position} == 0">
 Here is my add
</xen:if>
</xen:if>
 

bcercan

Active member
#4
well, in this case we cant show ads in conversation, if I want to show in first conversation message as well what should I do? {$message.position} doesnt works. any idea?
 
S

Syndol

Guest
#5
Depends on where you want to insert the ad.
If in template conversation_message then use
<xen:if is="{$conversation.first_message_id} == {$message.message_id}">
 

Kintaro

Well-known member
#7
I'm trying to print $post.position in conversation_message's template but it's null, any help?

{xen:helper dump, $post}
results NULL

{xen:helper dump, $message}
results in Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 46500460 bytes) in /Sites/xenforo-test/library/XenForo/Template/Abstract.php on line 251