Jun 13th, 2002, 12:24 PM
#1
Thread Starter
Fanatic Member
Someone asked about a Banner Exchange/Rotator
I found a copy of mine, but it doesnt rotate, but you can easily add that to the script.
http://www.cpradio.net/thebreakpoint...ange/index.php
Im not sure who was looking for this or when they were but here is one, and if you want the source I'll zip it and post it.
Jun 13th, 2002, 01:26 PM
#2
Stuck in the 80s
I don't get it
Jun 13th, 2002, 01:29 PM
#3
Thread Starter
Fanatic Member
Someone wanted a banner exchange/rotator script for their site and I thought I left the one I wrote in Ohio, but I just found it today on my server, and I will zip up the files and sql info when I get home so the person who wanted it or was attempting to make it can compare what I did to what they are doing.
If you make an account on that demo you will understand more.
-Matt
Jun 13th, 2002, 02:04 PM
#4
Stuck in the 80s
But the banner's always the same? I know, it doesn't rotate, but why not just code that in in HTML then if it doesn't change or anything?
I guess I'm just really confused.
Jun 13th, 2002, 02:07 PM
#5
Thread Starter
Fanatic Member
Okay, let me write up the about section which will explain it all.
That site allows you to have others add their banners to the exchange/rotation and will then spit out a line of code for you to place on your site to display the banners.
-Matt
Jun 13th, 2002, 02:16 PM
#6
Stuck in the 80s
ohhh...spiffy.
Jun 13th, 2002, 09:56 PM
#7
Thread Starter
Fanatic Member
Here is the files. Import the sql files then run installation by clicking on the install link.
-Matt
Attached Files
Last edited by cpradio; Jun 14th, 2002 at 07:30 AM .
Jun 14th, 2002, 01:09 PM
#8
Addicted Member
I believe I was the one looking for one but I created one with a little javascript/php hybrid.
//start script
<SCRIPT LANGUAGE="JavaScript">
// Banner Cycling Program
// S T A R T
var urls = new Array();
var bannerz = new Array();
var descripts = new Array();
<?
$bannerSQL = "SELECT * from banners ORDER BY ID";
$bannerQuery = mysql_query($bannerSQL);
$numberBanners = mysql_num_rows($bannerQuery);
//$numberBanners = $numberBanners - 1;
for ($z = 0; $z < mysql_num_rows($bannerQuery); $z++)
{
$zz = $z + 1;
$theBanner = mysql_result($bannerQuery, $z, 'bannerlink');
$theLink = mysql_result($bannerQuery, $z, 'url');
$theDescript = mysql_result($bannerQuery, $z, 'descript');
echo("bannerz[$zz] = \"$theBanner\";\n");
echo("urls[$zz] = \"$theLink\";\n");
echo("descripts[$zz] = \"$theDescript\";\n");
}
?>
var randomNumber;
function pickBanner()
{
randomNumber = Math.floor(Math.random()*<?echo($numberBanners);?>);
oldRandom = randomNumber;
randomNumber = randomNumber + 1;
document.mybanner.src=''+bannerz[randomNumber]+'';
//alert("Old Numb-"+oldRandom+" New Random-"+randomNumber);
window.status = ""+descripts[randomNumber]+"";
setTimeout("pickBanner()", 10000);
}
function setBanner()
{
randomNumber = Math.floor(Math.random()*<?echo($numberBanners);?>);
randomNumber = randomNumber + 1;
document.mybanner.src=''+bannerz[randomNumber]+'';
window.status = ""+descripts[randomNumber]+"";
setTimeout("pickBanner()", 10000);
}
function findURL()
{
enpage=window.open("goto.php?thisNum="+randomNumber+"&pid=<?echo($pid);?>","enpage","scrollbars=yes, toolbar=yes,directories=yes,menubar=yes,status=yes,location=yes, resizable=yes left=0, top=0");
}
// F I N I S H
</SCRIPT>
<body onload='setBanner'>
<a href='#' onclick='findURL()'><img href='#' src="<? echo($banner); ?>" name='mybanner' width="467" height="60" border="0"></a>
// end script
I probably dont need the href='#' in the img tag but if I take it out, I just know somethings going to break.
The reason for the + 1 in certain places is that I dont have any banners in my table that have an ID of 0... everything starts at 1 which gets tricky with loops and rows.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width