XF 1.2 Google ads in thread

Brogan

XenForo moderator
Staff member
#2
Use the ad_message_below template.

Then use this:
How can I show content after post x on every page in a thread?
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == x AND !{$message.conversation_id}">
This content will show after post x on every page in a thread
</xen:if>
 

tommydamic68

Well-known member
#3
Use the ad_message_below template.

Then use this:
How can I show content after post x on every page in a thread?
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == x AND !{$message.conversation_id}">
This content will show after post x on every page in a thread
</xen:if>
@Brogan I get this error message.

Screen Shot 2013-09-05 at 5.53.25 AM.png
 

tommydamic68

Well-known member
#5
Where do i place the google ad code here?

<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == x AND !{$message.conversation_id}">
This content will show after post x on every page in a thread
</xen:if>
 

Jeremy

Well-known member
#6
Replace the content between the xen:if. However, you need to replace the x in the conditional with a number for it to work. That's what the error message is complaining about.
 

tommydamic68

Well-known member
#10
ok - i have it, but his code is for guest, how do i make it for all? member, guests etc. Here is what i have so far.

hook name="ad_message_below" /><xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0">
<xen:if is="!{$visitor.user_id}">
<li class="message">
<div class="messageUserInfo" itemscope="itemscope"">
<div class="messageUserBlock">
<div class="avatarHolder">
<span class="helper"></span>
<xen:avatar user="$visitor" size="m" img="true" />
</div>
<h3 class="userText">
<span style="font-weight: bold">Sponsor</span>
</h3>
<span class="arrow"><span></span></span>
</div>
</div>
<div class="messageInfo primaryContent">
<div class="messageContent">
<article>
<blockquote class="messageText ugc baseHtml">
<script type="text/javascript">
google_ad_client = "ca-pub-id";
width = document.documentElement.clientWidth;
/* Message Below Responsive 2 */
google_ad_slot = "1234567890";
google_ad_width = 320;
google_ad_height = 50;
if (width > 619) {
/* Message Below Responsive 1 */
google_ad_slot = "1234567890";
google_ad_width = 468;
google_ad_height = 60;
}
if (width > 879) {
/* Message Below */
google_ad_slot = "1234567890";
google_ad_width = 728;
google_ad_height = 90;
}
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</xen:if>

</xen:if>
 

Brogan

XenForo moderator
Staff member
#15
I have limited net access currently and only from a mobile device so can only offer limited support.

What is it you're trying to do?
 

tommydamic68

Well-known member
#18
Actually, i want a border to match the site like this around this ad - see the border around the 2nd post ad with the sponsor title (anyway to center that ad?)- like that. I want the border like the 2nd image that i have the black line drawn around.



Screen Shot 2013-09-06 at 5.18.02 AM.png

Screen Shot 2013-09-06 at 5.18.15 AM.png
 
Top