Template Conditionals - Front Page Banner Ads

akia

Well-known member
I'm trying to set up some banner ads for my site but the problem I'm having is a leader board dosn't fit on the front page under the top bread crumbs, and a normal size banner looks odd when just viewing a thread etc.

Is there a Template Conditional that I can wrap my ad code up in so that if someone is on the home page it displays one ad code and if elsewhere it displays another.
 
Can you Nest If tags within each other?

Currently I've got:

Code:
<xen:if is="{$contentTemplate} == 'forum_list'">
<xen:if is="{$visitor.user_id}">
<div style="text-align: center; margin-top:8px;">
<script type='text/javascript'><!--// <![CDATA[
    OA_show(1);
// ]]> --></script>
</div>
<xen:else />
<div style="text-align: center; margin-top:8px;">
<script type='text/javascript'><!--// <![CDATA[
    OA_show(2);
// ]]> --></script>
</div>
</xen:if>
<xen:else />
<xen:if is="{$visitor.user_id}">
<div style="text-align: center; margin-top:8px;">
<script type='text/javascript'><!--// <![CDATA[
    OA_show(1);
// ]]> --></script>
</div>
<xen:else />
<div style="text-align: center; margin-top:8px;">
<script type='text/javascript'><!--// <![CDATA[
    OA_show(2);
// ]]> --></script>
</div>
</xen:if>
</xen:if>

Will this work
 
Let me piggy back on this thread as well.
I load javascript for a media player in page_container_js_head.
Code:
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
However, this player is mostly used for a private node which majority of our members will not see and need to load.

Which condition I should use to load this JS only under node id = x or category id = y?

Thanks Jake ;)
 
Let me piggy back on this thread as well.
I load javascript for a media player in page_container_js_head.
Code:
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
However, this player is mostly used for a private node which majority of our members will not see and need to load.

Which condition I should use to load this JS only under node id = x or category id = y?

Thanks Jake ;)

You need to pass the node_id using xen:container. Edit these two templates:

Admin CP -> Appearance -> Templates
> forum_view
> thread_view


Add this line to the top of each template:

Code:
<xen:container var="$forumId">{$forum.node_id}</xen:container>

Now you can use this condition for your javascript:

Rich (BB code):
<xen:if is="{$forumId} == 2">

</xen:if>
 
Can you guys tell me why my adsense ads don't show on the front page of my forum?

The same code works on other sites but just not here. I'm going crazy over this..

Help :eek:
 
As we discussed in the conversation, the content received from Google is blank.

You will need to speak to Google AdSense about this.
 
Code:
<script type="text/javascript"><!--
google_ad_client = "ca-pub-2340283517533441";
/* mlm-forums */
google_ad_slot = "8848259061";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

This is the code I use and why note add it to any xenforo forum and see if it works. If it does then we know we have a problem on my forum...
 
Top Bottom