• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Adding advertisements with template edits

Okay, another strange question. I created a User group called "Contributors" (user group #21). If I do NOT want them to see ads but want everyone else to I'd put:

<xen:if is="{$visitor.user_group_id} != 21"></xen:if>

Is that correct?

Edit: Yup. Tested and it works gangbusters.

So if you want people to be able to upgrade accounts and have them not see the advertisements, this is the way to go.
 
Very nice one. I am using the Ads appear posted by a fake user
Loving it ;)
I got 2 Question with it:
1. I am using an 728x90 Image Block. How can i center and middle it? Right now its at the very left and top.
2 Where and how can i add a popup if someone has an Adblocker activated?
Thanks for the Codes

Almost forgot:
If any is interested to get the "Google Adsense" Text a bit more looking in the User Colors add this to the EXTRA.css
Code:
.userText {
font-weight: bold;
color: @primaryMedium;
}
.userTitle {
color: @primaryLightish;
}

edit\ I wanted to include the "Top Leaderboard" from the 1. Post, but that is not working for me.
I am using this change http://xenforo.com/community/threads/hide-breadcrumb-on-index-page.9585/

Works now i just added <xen:include template="adsense_top" /> above <!-- top breadcrumb, top ctrl --> in page_container
 
Last silly question.

I have the Contributor user group (21) who does not see ads. Now I want to reopen my NSFW folder (which I closed due to TOS with Google Adsense) and I can't have the ads hit there. I have tried a couple different ways to get it to work but it does not.

Attempt #1:

Code:
<xen:if is="{$forum.node_id} != 118 OR {$forum.node_id} != 119 OR {$visitor.user_group_id} != 21">

<div style="text-align: center; margin-top:8px;">
    <script type="text/javascript"><!--
google_ad_client = "ca-pub-9680253439868204";
/* XFTopAd */
google_ad_slot = "7671666545";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</xen:if>

Attempt #2:

Code:
<xen:if is="{$forum.node_id} != 118">
<xen:if is="{$forum.node_id} != 119">
<xen:if is="{$visitor.user_group_id} != 21">

<div style="text-align: center; margin-top:8px;">
    <script type="text/javascript"><!--
google_ad_client = "ca-pub-9680253439868204";
/* XFTopAd */
google_ad_slot = "7671666545";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</xen:if>
</xen:if>
</xen:if>

So what am I missing?
 
Hi there. is it possible to get the adsense_top Code just to the /index.php and /index.php?forums/ page(s)?
 
this is amazing but how can i display ads in the first post im using this condition in the template message but the ads appear into the conversation
Code:
<xen:if is="{$post.post_id} == {$thread.first_post_id}">
i need a condition to verify that make the ads appear only in the showthread page
 
Thanks with this but a quick quesiton.

I want to use a leaderboard for the top banner but on the index page becuase of the sidebar it overlaps everything.

is there a way that i can show one ad on the index and another on the rest of the pages, I'm guessting I can wrap the differend ad codes in a if and else statement but which one would i need to use.
 
Is there a way to get this to show after the first page on all page's (not just the first page)

Thanks

edit = nvm had to move it all in "pm" there was loads of them after each msg
cheers tho
 
Last silly question.

I have the Contributor user group (21) who does not see ads. Now I want to reopen my NSFW folder (which I closed due to TOS with Google Adsense) and I can't have the ads hit there. I have tried a couple different ways to get it to work but it does not.

Attempt #1:

Code:
<xen:if is="{$forum.node_id} != 118 OR {$forum.node_id} != 119 OR {$visitor.user_group_id} != 21">

<div style="text-align: center; margin-top:8px;">
    <script type="text/javascript"><!--
google_ad_client = "ca-pub-9680253439868204";
/* XFTopAd */
google_ad_slot = "7671666545";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</xen:if>

So what am I missing?

those should be AND not OR

if it's not node 118 and not note 119 and not group 21 then show code. AND makes it so they all have to be true.

the way you have it with OR, only one of them has to be true. when you are in node 118 it would be true that it's not 119 & show the code and vice versa
 
Top Bottom