• 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

Any guidance for header ad placement?

here ya go. make new template adsense_header
<div style="float: right; margin-top:5px; margin-right: 30px;">
I wish I could have figured out how to get the correct indent from the xen style settings but i'm clueless. just manually edit the margin numbers so ti looks right for you. unless someone wants to chime in.

anyway, then in template header add
    <xen:include template="adsense_header" />
right after
<div id="header">

this will give you an ad in the header location slid all the way over to the right side. well, 30px from the right side.
Top tip: rather than put your top leaderboard where it is now, reduce your logo size and put your top leaderboard to the right of your logo where that huge big empty space is right now.
That way your content is lifted up the page by 90 pixels (plus margins).
Add it to the thread_view template just before:
<xen:hook name="thread_view_qr_before" params="{xen:array 'thread={$thread}'}" />
Add it to the thread_view template just before:
<xen:hook name="thread_view_qr_before" params="{xen:array 'thread={$thread}'}" />
I ended up putting the code at the bottom of the template. For some reason, the space there seems to expand for a second before resizing to the correct banner size.

You can take a look at the bottom of this thread here

Here is the part of the code right after the Share This Page part
<xen:include template="share_page">
    <xen:set var="$url">{xen:link 'canonical:threads', $thread}</xen:set>

<center><script type='text/javascript'><!--//<![CDATA[
   var m3_u = (location.protocol=='https:'?'https://www.quantnet.com/openx/www/delivery/ajs.php':'http://www.quantnet.com/openx/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=1");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
<?php $rd = rand() ?>
<noscript><a href='http://www.quantnet.com/openx/www/delivery/ck.php?n=af6d3de8&amp;cb=<?php $rd = rand() ?>' target='_blank'><img src='http://www.quantnet.com/openx/www/delivery/avw.php?zoneid=1&amp;cb=<?php $rd = rand() ?>&amp;n=af6d3de8' border='0' alt='' /></a></noscript></center>
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 i need a condition to verify that make the ads appear only in the showthread page

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

Try adding this to the conditional: AND !{$message.conversation_id}

Source: http://xenforo.com/community/threads/no-ad-in-conversation-window.7932/#post-110483
Is there a way to get this to show after the first page on all page's (not just the first page)
i wish i can help is it possible to make it appear as the last post in a thread in every page

Try the following conditional: <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0">...</xen:if>

Source: http://xenforo.com/community/thread...er-first-post-on-every-page.9629/#post-132221
Might be useful for ads, a condition to target visitors from search engine: http://xenforo.com/community/threads/xenforo-1-0-0-rc3-release-candidate-3.12622/#post-166147
A commonly-requested feature is the ability to identify visitors who have arrived on your site from a search engine result page, in order to target appropriate advertising etc. to them. XenForo now exposes this information in the session and visitor objects, allowing you to customize your templates and add-ons in any way you see fit. This information remains available for the duration of the visitor's browsing session.

<xen:if is="{$visitor.from_search}">
<!-- content to display to visitors referred by a search engine -->

The URL of the page from which a visitor landed is now available as 'referer' within the session and visitor objects, wherever they came from.
Any idea how to put adsense in the PAGE_CONTAINER where the adverts only show to guests/unregistered?
Top Bottom