Adsense Layout and Placement

swatme

Well-known member
Hi

is there any guide on adsense placement on XF?

i tried to test the Ad_Message_below template
but it shows the test text message in every messages...

how can i set it to what post it will appear?
 
In that case you know the code is working, but Adsense isn't always returning an ad. That can be normal under certain circumstances. See this article:

http://www.yugatech.com/blog/adsense/seeing-blank-adsense-ads/

Template modifications that are common to multiple styles can be added to a parent style. All styles underneath a parent will inherit the parent's customizations. Or you can just make the same changes to all of your styles individually.
Ah, so it seems there is nothing wrong with my templates, then, it's simply AdSense not always displaying an ad.

And I also found that yes, all my styles are now getting the AdSense box from time to time. Thanks for all your help.
 
i implemented adsense already...
i just have this idea..

in the template, ad_thread_below_stickies:
your ads will show below the sticky posts.

my question is,
if theres no stickies, it will show on the top most.
how can i set that it will show after 2 threadpost?

just like in message post using the ff if conditionals
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 1">

how can i apply it in ad_thread_below_stickies to show after 1 or 2 threads

thanks
 
i implemented adsense already...
i just have this idea..

in the template, ad_thread_below_stickies:
your ads will show below the sticky posts.

my question is,
if theres no stickies, it will show on the top most.
how can i set that it will show after 2 threadpost?

just like in message post using the ff if conditionals
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 1">

how can i apply it in ad_thread_below_stickies to show after 1 or 2 threads

thanks

Edit this template:

Admin CP -> Appearance -> Templates -> thread_list

Replace this code:

Code:
	<ol class="discussionListItems">
	<xen:if is="{$stickyThreads} OR {$threads}">
		<xen:set var="$showLastPageNumbers">1</xen:set>
	
		<xen:hook name="thread_list_stickies">
		<xen:foreach loop="$stickyThreads" value="$thread">
			<xen:include template="thread_list_item" />
		</xen:foreach>
		</xen:hook>
		
		<xen:include template="ad_thread_list_below_stickies" />
		
		<xen:hook name="thread_list_threads">
		<xen:foreach loop="$threads" value="$thread">
			<xen:include template="thread_list_item" />
		</xen:foreach>
		</xen:hook>
		
		<xen:edithint template="thread_list_item_edit" />
	<xen:else />
		<li class="primaryContent">{xen:phrase there_no_threads_to_display}</li>
	</xen:if>
	</ol>

with this:

Code:
	<ol class="discussionListItems">
	<xen:if is="{$stickyThreads} OR {$threads}">
		<xen:set var="$showLastPageNumbers">1</xen:set>
	
		<xen:hook name="thread_list_stickies">
		<xen:foreach loop="$stickyThreads" value="$thread">
			<xen:include template="thread_list_item" />
		</xen:foreach>
		</xen:hook>

		<xen:if is="{$stickyThreads}">
			<xen:include template="ad_thread_list_below_stickies" />
		</xen:if>

		<xen:hook name="thread_list_threads">
		<xen:foreach loop="$threads" value="$thread" i="$i">

			<xen:include template="thread_list_item" />

			<xen:if is="!{$stickyThreads} AND {$i} == 2">
				<xen:include template="ad_thread_list_below_stickies" />
			</xen:if>

		</xen:foreach>
		</xen:hook>
		
		<xen:edithint template="thread_list_item_edit" />
	<xen:else />
		<li class="primaryContent">{xen:phrase there_no_threads_to_display}</li>
	</xen:if>
	</ol>

Now the adsense code in the ad_thread_list_below_stickies template will show after the sticky threads, or after the second thread in the list if there are no stickies.
 
If I am not mistaken this should be the code used for newer XF versions.

Code:
    <ol class="discussionListItems">
    <xen:if is="{$stickyThreads} OR {$threads}">
        <xen:set var="$showLastPageNumbers">1</xen:set>
        <xen:set var="$linkPrefix">1</xen:set>
   
        <xen:hook name="thread_list_stickies">
        <xen:foreach loop="$stickyThreads" value="$thread">
            <xen:include template="thread_list_item" />
        </xen:foreach>
        </xen:hook>

        <xen:if is="{$stickyThreads}">
            <xen:include template="ad_thread_list_below_stickies" />
        </xen:if>

        <xen:hook name="thread_list_threads">
        <xen:foreach loop="$threads" value="$thread" i="$i">

            <xen:include template="thread_list_item" />

            <xen:if is="!{$stickyThreads} AND {$i} == 2">
                <xen:include template="ad_thread_list_below_stickies" />
            </xen:if>

        </xen:foreach>
        </xen:hook>
       
        <xen:edithint template="thread_list_item_edit" />
    <xen:else />
        <li class="primaryContent">{xen:phrase there_no_threads_to_display}</li>
    </xen:if>
    </ol>
 
Top Bottom