random banner in overall

This forum is now closed. Please ask all styles-related questions in the phpBB 3.0 Styles Support & Discussion Forum.
Locked
berlusconi
Registered User
Posts: 25
Joined: Thu Jan 12, 2006 10:40 pm
Contact:

random banner in overall

Post by berlusconi » Thu Oct 12, 2006 8:42 pm

Hello!

I need your help.
I try to get a random banner in my forum but it dont work very well.
In firefox it works, but in IE it dont.
would be very very great if someone could help me or do this for me.
im not so good in html an it would be great if u could do this for me.
this is "old" overall header
www.jawl.de/overall_header.tpl

this is my new try to do it
www.jawl.de/javafehlerhaftoverall_header.tpl

it works in firefox but not in IE.

if someone gets this to work i can give u a link on my webside (Pr3 an over 5000 visitors a month)
thank u

User avatar
will_hough
Former Team Member
Posts: 1952
Joined: Mon Feb 06, 2006 8:47 pm
Location: Michigan
Name: Will Hough
Contact:

Post by will_hough » Fri Oct 13, 2006 3:51 pm

This is a script I use for a random banner on one of my forums.

Open overall_header.tpl
Place this after <head> but before </head>

Code: Select all

<script language="JavaScript">
<!--
var banner = new Array()

banner[0] = 'templates/AdInfinitum/images/top_27.gif" alt="27'
banner[1] = 'templates/AdInfinitum/images/top_aaron_d.gif" alt="Aaron Dallison - Keelhaul'
banner[2] = 'templates/AdInfinitum/images/top_aturner1.gif" alt="Aaron Turner - Lotus Eaters'
banner[3] = 'templates/AdInfinitum/images/top_bbusiness.gif" alt="Big Business'
banner[4] = 'templates/AdInfinitum/images/top_boris.gif" alt="Boris'
banner[5] = 'templates/AdInfinitum/images/top_chang.gif" alt="John Chang - Discordance Axis'
banner[6] = 'templates/AdInfinitum/images/top_daughters.gif" alt="Daughters'
banner[7] = 'templates/AdInfinitum/images/top_didier.gif" alt="Didier - Knut'
banner[8] = 'templates/AdInfinitum/images/top_b-herweg.jpg" alt="Bryan Herweg - Pelican'
banner[9] = 'templates/AdInfinitum/images/top_isis.gif" alt="Isis'
banner[10] = 'templates/AdInfinitum/images/top_khanate.gif" alt="Khanate'
banner[11] = 'templates/AdInfinitum/images/top_omalley.gif" alt="Stephen O`Malley - SunnO)))'
banner[12] = 'templates/AdInfinitum/images/top_5ive.gif" alt="5ive'
banner[13] = 'templates/AdInfinitum/images/top_l-lebec.jpg" alt="Laurent Lebec - Pelican'
banner[14] = 'templates/AdInfinitum/images/top_botch.jpg" alt="Botch'
var j = 0
var p = banner.length;

var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = banner[i]
}

var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+banner[whichImage]+'" id="topbanner" />');
}

//-->
</script>
This will go in the body where your banner will be displayed:

Code: Select all

<a href="{U_INDEX}"><script language="JavaScript">
<!--
showImage();
//-->
</script></a>

berlusconi
Registered User
Posts: 25
Joined: Thu Jan 12, 2006 10:40 pm
Contact:

Post by berlusconi » Sat Oct 14, 2006 2:55 am

thx, but dont get it to work.
my banners are just url's as u see in script
for example

Code: Select all

<iframe 

src="http://banners.webmasterplan.com/view.asp?site=138

2&ref=276013&type=text&tnb=32&showjs=0&template=1308&Ca

tegoryID=39826&query=(plasma||||)&refurl='+escape(docum

ent.location.href)+'" width="160" height="600" 

marginheight="0" marginwidth="0" frameborder="0" 

scrolling="no"></iframe>'
would be nice if u could help me to fix this problem

maplehack
Registered User
Posts: 6
Joined: Sun Nov 12, 2006 3:00 am

Post by maplehack » Mon Jan 01, 2007 10:08 pm

Thank you "will_hough"
It works for me

One more help need

I want that my random picture link to their destination, each.
ex.
I have 2 images, A.gif and B.gif.
I want A.gif go to www.A.com
and
I want B.gif go to www.B.com

How ??

Thank

User avatar
will_hough
Former Team Member
Posts: 1952
Joined: Mon Feb 06, 2006 8:47 pm
Location: Michigan
Name: Will Hough
Contact:

Post by will_hough » Mon Jan 01, 2007 11:34 pm

maplehack wrote: Thank you "will_hough"
It works for me

One more help need

I want that my random picture link to their destination, each.
ex.
I have 2 images, A.gif and B.gif.
I want A.gif go to www.A.com
and
I want B.gif go to www.B.com

How ??

Thank


You will need a different script.
Place this script where you want the images to appear in the body.
i.e. inside div or td tags.

Code: Select all

<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
function random_imglink(){
var banner=new Array()

banner[1]="images/A.gif"
banner[2]="images/B.gif"

var alt=new Array()

alt[1]="A Image alt text"
alt[2]="B Image alt text"

var banlink=new Array()
banlink[1]="http://www.a.com"
banlink[2]="http://www.b.com"

var ry=Math.floor(Math.random()*banner.length)
if (ry==0)
ry=1
document.write('<a href='+'"'+banlink[ry]+'"'+' target="_blank"><img src="'+banner[ry]+'" border=0 alt="'+alt[ry]+'"></a>')
}
random_imglink()
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>

dogfart
Registered User
Posts: 28
Joined: Wed Jul 11, 2007 7:45 pm

Re:

Post by dogfart » Fri Feb 01, 2008 12:53 am

will_hough wrote:
This will go in the body where your banner will be displayed:

Code: Select all

<a href="{U_INDEX}"><script language="JavaScript">
<!--
showImage();
//-->
</script></a>
I'm sorry to resurrect such an old thread, but how do I go about centering and positioning the portion that goes in the body so that the banner is just above the name of the board? We're running phpbb 3.0.

Thank you!

Locked

Return to “[2.0.x] Styles Development & Discussion”