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

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? :)
 
Use the ad_message_body template and float the content right.

Use a conditional to restrict it to the first post: http://xenforo.com/community/threads/frequently-asked-questions.5183/#post-182355

Like this:
Code:
<xen:hook name="ad_message_body" />
<xen:if is="{$post.position} == 0 AND !{$message.conversation_id}">
<div style="float: right">
Ad content here
</div>
</xen:if>
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? :)
 
<div style="float: right; padding-left: 5px">

Oh I missed the second point. Use this code instead:
Code:
<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
</div>
</div>
</xen:if>
 
<div style="float: right; padding-left: 5px">

Oh I missed the second point. Use this code instead:
Code:
<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
</div>
</div>
</xen:if>
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?
 
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?
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?
 
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?
 
<div style="float: right; padding-left: 5px">

Oh I missed the second point. Use this code instead:
Code:
<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
</div>
</div>
</xen:if>


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.
 
Top Bottom