1. 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 ?

Discussion in 'XenForo Questions and Support' started by account8226, Mar 4, 2012.

  1. account8226

    account8226 Guest

    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>
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    MuraTh and (deleted member) like this.
  3. account8226

    account8226 Guest

    Working perfectly thanks Brogan :)
     
  4. bcercan

    bcercan Active Member

    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?
     
  5. Syndol

    Syndol Guest

    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}">
     
  6. bcercan

    bcercan Active Member

    its works perfectly , thank you bro ;)
     
  7. Kintaro

    Kintaro Well-Known Member

    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
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Conversations messages don't have position IDs.
     

Share This Page