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

XF 1.1 Display Advertisement In First Post; Right Aligned Like in vB

Discussion in 'XenForo Questions and Support' started by TheBigK, Nov 17, 2011.

  1. TheBigK

    TheBigK Well-Known Member

    I'm aware of existing advertisement locations in XenForo. But can't seem to find a way to display a 300x250 rectangle on the right side of the content in first post. Does anyone know how to do that? :)
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Bram likes this.
  3. TheBigK

    TheBigK Well-Known Member

    Brogan: You are Awesome!

    I'll go ahead and ask for more -

    1. The text runs into the ads. How do I add 5 pixel margin around the ad spot?
    2. If the text in first post is just 1 line; then the ad-spot occupies the signature area as well. Is there a way to fix this? :)
  4. Brogan

    Brogan XenForo Moderator Staff Member

    <div style="float: right; padding-left: 5px">

    Oh I missed the second point. Use this code instead:
    <xen:hook name="ad_message_body" />
    <xen:if is="{$post.position} == 0 AND !{$message.conversation_id}">
    <div style="min-height: 250px">
    <div style="float: right; padding-left: 5px">
    Ad content here
    jauburn and TheBigK like this.
  5. TheBigK

    TheBigK Well-Known Member

    Hi Brogan. This works well. Just a little problem. If the post has attachment, then the attachment section in post runs into the ad-spot. Is it possible to limit the size of attachment section so that it does not mess with the advertisement?
  6. TheBigK

    TheBigK Well-Known Member

    Quoting myself. Can someone suggest a CSS fix for this issue?

    The code above beautifully shows advertisement in the first post as expected. However, if the first post has an attachment or say a quote, then the quote runs into the advertisement. Is there a way to automatically adjust the width of quote when an advertisement is displayed?
  7. TheBigK

    TheBigK Well-Known Member

    Just a question: The above hack shows post only after first post in the thread. I'd ideally like to show the advertisement in every top post on all the pages in thread. What condition should I use?
  8. Brogan

    Brogan XenForo Moderator Staff Member

    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
    TheBigK likes this.
  9. TheBigK

    TheBigK Well-Known Member

    You are - A-W-E-S-O-M-E-S-T! :D

    May I request the CSS trick to prevent the 'quotes' and 'attachments area' running into advertisements in first post? :unsure:
  10. jauburn

    jauburn Well-Known Member

    How do you get this code to fall at the bottom of the first post rather than the top? That is, after the post text, not before, and to the left, not right? Thanks.
  11. eagle eyes

    eagle eyes Active Member

    Need to know this as well

Share This Page