Tutorials Random Ads Code

RankBit

Registered Member
Joined: Mar 16, 2021
Messages: 11,941
Resources: 42
Points: 113
Reaction score: 5,009
Age: 31
Compatible XF Versions2.0 , 2.1 , 2.2
Write your ad code where it says banner.

It will randomly show an ad every time you refresh the page where you inserted the ad. It is the adaptation of the codes in Xenforo 1.x version for Xenforo 2.x.

Code:
<xf:comment>DEFINE AND RANDOMIZE YOUR BANNERS</xf:comment>
<xf:set var="$banners.1">banner 1</xf:set>
<xf:set var="$banners.2">banner 2</xf:set>
<xf:set var="$banners.3">banner 3</xf:set>
{$banners.{{ ($xf.time % 3) + 1 }}|raw}
 

Kamso

Registered Member
Joined: Apr 30, 2022
Messages: 4
Points: 1
Reaction score: 0
Compatible XF Versions2.0 , 2.1 , 2.2
Write your ad code where it says banner.

It will randomly show an ad every time you refresh the page where you inserted the ad. It is the adaptation of the codes in Xenforo 1.x version for Xenforo 2.x.

Code:
<xf:comment>DEFINE AND RANDOMIZE YOUR BANNERS</xf:comment>
<xf:set var="$banners.1">banner 1</xf:set>
<xf:set var="$banners.2">banner 2</xf:set>
<xf:set var="$banners.3">banner 3</xf:set>
{$banners.{{ ($xf.time % 3) + 1 }}|raw}
Where while I paste this whole entire code ?
 
Top