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

Display A Random Banner

#22
Also, call the image from its relative path:

HTML:
<a href="http://www.path.de"><img src="/images/header/header1.jpg"></a>
Not from a full URL, like you are doing:

HTML:
<a href="http://www.path.de"><img src="http://www.path.de/images/header/header1.jpg"></a>
I thought I was very clear with my example above. :)
 

bt012ss

Well-known member
#23
I thought I was very clear with my example above.
I also think so ;)

My Code, the result you know
With or without a slash before "images/header/"
it´s the same.

Code:
<xen:hook name="ad_below_content" />
<xen:comment>DEFINE AND RANDOMIZE YOUR BANNERS</xen:comment>

<xen:set var="$banners.1"><a href="http://www.path.de"><img src="images/header/header1.jpg"></a></xen:set>
<xen:set var="$banners.2">images/header/header2.jpg</xen:set>
<xen:set var="$banners.3">images/header/header3.jpg</xen:set>
<xen:set var="$banners.4">images/header/header4.jpg</xen:set>
<xen:set var="$banners.5">images/header/header5.jpg</xen:set>
<xen:set var="$banners.6">images/header/header6.jpg</xen:set>
<xen:set var="$banners.7">images/header/header7.jpg</xen:set>
<xen:set var="$banners.8">images/header/header8.jpg</xen:set>
<xen:set var="$banners.9">images/header/header9.jpg</xen:set>
<xen:set var="$banners.10">images/header/header10.jpg</xen:set>

<center><img src="{xen:raw '$banners.{xen:calc '({$serverTime} % 10) + 1'}'}" /></center>
 
#24
Hi @bt012ss,

Well, the error is right there. You are duplicating tasks, when putting the "src" in both the xen:set and the xen:raw.

First, I would suggest you start with just 2 banners, or even 1. Once those are working, you would have learnt and will be confident enough to add more.

Please try with this code in an empty template:

HTML:
<xen:set var="$banners.1">
<a href="http://www.path.de"><img src="/images/header/header1.jpg"></a>
</xen:set>
{xen:raw '$banners.{xen:calc '({$serverTime} % 1) + 1'}'}
Good luck.
 

bt012ss

Well-known member
#26
@japersonal

I found the right code by try and error and of course with your great tips.
Thank you very much for your time :cool:

Without a slash before the relative path the code is now correct.

Code:
<xen:hook name="ad_below_content" />
<xen:comment>DEFINE AND RANDOMIZE YOUR BANNERS</xen:comment>

<xen:set var="$banners.1"><a href="http://www.xx.de"><img src="styles/haendler/footer/mbs.png"></a></xen:set>
<xen:set var="$banners.2"><a href="http://www.xx.de"><img src="styles/haendler/footer/lutz.jpg"></a></xen:set>
<xen:set var="$banners.3"><a href="http://www.xx.de"><img src="styles/haendler/footer/motocoach.jpg"></a></xen:set>
<xen:set var="$banners.4"><a href="http://www.xx.de"><img src="styles/haendler/footer/motorcycle-service.jpg"></a></xen:set>
<xen:set var="$banners.5"><a href="http://www.xx.cc"><img src="styles/haendler/footer/motorismo.jpg"></a></xen:set>
<xen:set var="$banners.6"><a href="http://www.xx.de"><img src="styles/haendler/footer/spyder.jpg"></a></xen:set>
<xen:set var="$banners.7"><a href="http://www.xx.de"><img src="styles/haendler/footer/tecbike.jpg"></a></xen:set>
<xen:set var="$banners.8"><a href="http://www.xx.de"><img src="styles/haendler/footer/aundb.png"></a></xen:set>
<xen:set var="$banners.9"><a href="http://www.xx.de"><img src="styles/haendler/footer/hafeneger.png"></a></xen:set>
<xen:set var="$banners.10"><a href="http://www.xx.de"><img src="styles/haendler/footer/jajauma.png"></a></xen:set>

<center>{xen:raw '$banners.{xen:calc '({$serverTime} % 10) + 1'}'}</center>
 

wickedstangs

Well-known member
#29
I tried putting this code and it messes up Jaxel front page portal.. What am I doing wrong?
Code:
<xen:comment>DEFINE AND RANDOMIZE YOUR BANNERS</xen:comment>

<xen:set var="$banners.1"><center><a href="http://stangshiftergaskets.com/"><img src="http://www.terminatormustangs.com/images/stangshifter/stangshifter.png" width="468" height="60" /></center></xen:set>

{xen:raw '$banners.{xen:calc '({$serverTime} % 1) + 1'}'}
 

Mian Shahid

Well-known member
#36
How can i add some text above banners?
@Brogan
:D
Code:
<xen:hook name="ad_above_top_breadcrumb" />
<xen:comment>DEFINE AND RANDOMIZE YOUR BANNERS</xen:comment>
<div style="text-align: center;"><script type="text/javascript">
MY TEXT & CODING
</script></div>
<xen:set var="$banners.1"><a href="http://www.SITE.com"><img src="images/banner1.png"></a></xen:set>
<xen:set var="$banners.2"><a href="http://www.SITE.com"><img src="images/banner2.png"></a></xen:set>

<center>{xen:raw '$banners.{xen:calc '({$serverTime} % 2) + 1'}'}</center>
 

Mian Shahid

Well-known member
#40
how can i set those banner image width to 100%? is their any code to add in EXTRA.css or some ware else?
Solved :)
Code:
<xen:set var="$banners.1"><a href="http://www.site.com"><img style="max-width: 100%" src="images/ads/banner1.jpg"" ></a></xen:set>
<xen:set var="$banners.2"><a href="http://www.site.com"><img style="max-width: 100%" src="images/ads/banner2.gif" ></a></xen:set>