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

XF 1.5 Having an issue getting the Ads to work with conditional statements

#1
Hello,

I'm trying to place an ad in between the first and second post and also limit the ads to not show for administrators or any usergroup that has to do with me.

I found the exact 2 statements and placed them in the ad_message_below template along with adsense code and a <div> tag to name the class as I found in another tutorial. I then used the class in Extra.css

I tried with the statements in both the template and extra.css but neither worked.

I'm not sure exactly which template is ideal for these statements as the tutorial did not say.

Please direct me to the right way of doing this.

Thanks.
 

Martok

Well-known member
#4
Maybe you could post an example of the code, saying what you want to happen and what is actually happening.

Also what's the purpose of adding a class - to do what exactly?
 
#5
I'm following this tutorial:

How To Create A Google Adsense Account And Install Ads

This is my code for ad_message_below:

Code:
<xen:if is="!{xen:helper ismemberof, $user, Administrator, Bots}">
<xen:if is="{$post.position} == 0 AND !{$message.conversation_id}">
<div class="longads">
Ad code here
</div>
</xen:if>
</xen:if>
Then I add this to extra.css:

Code:
.longads {
width:728px; margin-left: auto; margin-right: auto;
}
The above code does not work for getting the ad to appear between the first and the second post.

Furthermore it does not work for blocking out administrators and another usergroup I call "Bots" from seeing the ads.

When I put the code in, the ads are still there.

Possibly I am using the wrong template. Please explain to me the correct template to use in order to achieve this. Also, I would like to know what is the correct format for placing an ad. You say I don't need to use a class. So can anyone tell me how it should be done? Thanks.