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

XF 1.3 How to put ad only on homepage

Robby

Well-known member
#1
Hello,

I would like to put an ad on the first page below the top breadcrumb. How can i prevent it to be shown on other pages?
 

Robby

Well-known member
#3
I don't see any conditional statements for just displaying on the home page.
Just with forum id but the homepage doesn't have that.
 

Valhalla

Well-known member
#4
You could modify the forum_list template and add what you want to show accordingly.

If you want to show something below the navigation, then you should modify above:

Code:
<xen:hook name="forum_list_nodes">
    <xen:if is="{$renderedNodes}"><xen:include template="node_list" /></xen:if>
</xen:hook>
 

Robby

Well-known member
#5
You could modify the forum_list template and add what you want to show accordingly.

If you want to show something below the navigation, then you should modify above:

Code:
<xen:hook name="forum_list_nodes">
    <xen:if is="{$renderedNodes}"><xen:include template="node_list" /></xen:if>
</xen:hook>
Do i just have to put a template where it says include template in the code?
 

Brogan

XenForo moderator
Staff member
#6
If by "home" page you mean the forum list, then:

How can I show content on a specific page?
<xen:if is="{$contentTemplate} == 'forum_list'">
This content will show on the forum list
</xen:if>
 

daviden

Active member
#8
If by "home" page you mean the forum list, then:

How can I show content on a specific page?
<xen:if is="{$contentTemplate} == 'forum_list'">
This content will show on the forum list
</xen:if>
Hi, sorry for bringing up a super old thread.
I'm using this for showing ads in my ad_above_top_breadcrumb, works fine. Then I wanted to randomize some ads, and it works fine for this rule: <xen:if is="{$forum.node_id} == 'number of forum'">

But I get a syntax error when I try to put my randomize code in <xen:if is="{$contentTemplate} == 'forum_list'">

The randomize code is like this:

<xen:if is="{$contentTemplate} == ’forum_list’”>
<xen:set var="$banners.1"><a href="ad1.php" target="_blank"><img src="ad1.jpg" width="100%" alt="ad 1"></a></xen:set>
<xen:set var="$banners.2"><a href="ad2.php" target="_blank"><img src="ad2.jpg" width="100%" alt="ad 2"></a></xen:set>
{xen:raw '$banners.{xen:calc '({$serverTime} % 2) + 1'}'}
</xen:if>

Skärmavbild 2017-04-07 kl. 22.09.17.png



Is there another way to solve this? Putting my randomize ads on the first/main page - the forum list that is.
 

xenfans

Well-known member
#17
Let's start at the beginning for you.

What template are you trying to add your conditionals to, to try and show your random banners? What's the name of that template?