JamesBrown
Well-known member
I have found that an advert after the first post is one of the best adsense earners. can someone post an idiots guide to achieving this with with XF. Thanks in anticipation.
<xen:if is="{$forum.node_id} != 403">
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$visitor.user_id}">
<li class="post_advert message">
<div class="messageUserInfo">
<div class="messageUserBlock">
<div class="avatarHolder"><span class="avatar av2m"><img src="http://xxxxx.com/xf/styles/xxxxx/xenforo/xxxxx/advatar.png" width="96px" height="96px"></span></div>
<h3 class="userText" style="padding-bottom:10px;">
Google
<em class="userTitle" itemprop="title">Advertisement</em>
</h3>
<span class="arrow"><span></span></span>
</div>
</div>
<div class="messageInfo">
<div class="advert_content">
<xen:if is="!{$visitor.user_id}"><script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxx";
/* XF_728_Top_Above_Content */
google_ad_slot = "xxxxx";
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>
</div>
</div>
</li>
</xen:if>
</xen:if>
..and just stack them on top of each other? ThanksDuplicate that block using a different adsense unit and change the 0 in the second line to 2.
This is a better version. Uses the guest avatar, so it's using the full responsive CSS available.
HTML:<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0"> <li class="message"> <div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person"> <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">NAME</span> <em class="userTitle" itemprop="title">TITLE</em> </h3> <span class="arrow"><span></span></span> </div> </div> <div class="messageInfo primaryContent"> <div class="messageContent"> <article> <blockquote class="messageText ugc baseHtml"> YOUR ADVERT </blockquote> </article> </div> </div> </li> </xen:if>
<xen:hook name="ad_message_below" />
<xen:if is="!{xen:helper ismemberof, $visitor, 6, 4, 3}">
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0">
<li class="sectionMain message">
<div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person">
<div class="messageUserBlock">
<div class="avatarHolder">
<span class="helper"></span>
<a class="avatar Avm" data-avatarhtml="true"><img src="@imagePath/xenforo/avatars/avatar_m.png" width="96" height="96" alt=""></a>
</div>
<h3 class="userText">
<span style="font-weight: bold">GoogleAdsense</span>
<em class="userTitle" itemprop="title">Guest Advertisement</em>
</h3>
<span class="arrow"><span></span></span>
</div>
</div>
<div class="messageInfo primaryContent">
<div class="messageContent">
<article>
<blockquote class="messageText ugc baseHtml">
<xen:if is="!{xen:helper ismemberof, $visitor, 6, 4, 3}">
<div class="addtop">
<script>
Google code
</script>
</div>
</xen:if>
</blockquote>
</article>
</div>
</div>
</li>
</xen:if>
</xen:if>
This is what I'm using now. I've removed my google code, but you can get the idea from it for styling the post part.Code:<xen:hook name="ad_message_below" /> <xen:if is="!{xen:helper ismemberof, $visitor, 6, 4, 3}"> <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0"> <li class="sectionMain message"> <div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person"> <div class="messageUserBlock"> <div class="avatarHolder"> <span class="helper"></span> <a class="avatar Avm" data-avatarhtml="true"><img src="@imagePath/xenforo/avatars/avatar_m.png" width="96" height="96" alt=""></a> </div> <h3 class="userText"> <span style="font-weight: bold">GoogleAdsense</span> <em class="userTitle" itemprop="title">Guest Advertisement</em> </h3> <span class="arrow"><span></span></span> </div> </div> <div class="messageInfo primaryContent"> <div class="messageContent"> <article> <blockquote class="messageText ugc baseHtml"> <xen:if is="!{xen:helper ismemberof, $visitor, 6, 4, 3}"> <div class="addtop"> <script> Google code </script> </div> </xen:if> </blockquote> </article> </div> </div> </li> </xen:if> </xen:if>
No, just the ad_ templates.
The above is achieved very simply, like so:
This is what I'm using now. I've removed my google code, but you can get the idea from it for styling the post part.Code:<xen:hook name="ad_message_below" /> <xen:if is="!{xen:helper ismemberof, $visitor, 6, 4, 3}"> <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0"> <li class="sectionMain message"> <div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person"> <div class="messageUserBlock"> <div class="avatarHolder"> <span class="helper"></span> <a class="avatar Avm" data-avatarhtml="true"><img src="@imagePath/xenforo/avatars/avatar_m.png" width="96" height="96" alt=""></a> </div> <h3 class="userText"> <span style="font-weight: bold">GoogleAdsense</span> <em class="userTitle" itemprop="title">Guest Advertisement</em> </h3> <span class="arrow"><span></span></span> </div> </div> <div class="messageInfo primaryContent"> <div class="messageContent"> <article> <blockquote class="messageText ugc baseHtml"> <xen:if is="!{xen:helper ismemberof, $visitor, 6, 4, 3}"> <div class="addtop"> <script> Google code </script> </div> </xen:if> </blockquote> </article> </div> </div> </li> </xen:if> </xen:if>
We use essential cookies to make this site work, and optional cookies to enhance your experience.