Hi,
I have done some research and have found an example of a banner rotator (that I'm presently using) - as you can see here: http://www.clickteesside.com/
What I'm wanting to do is like the imgsrc, links and message of the rotator to a database value, so that there are more or less images in rotation based on the amount of records in the database.
I have already set up a table (click.click_banners):
- id
- bannerVisible (int)
- bannerImagePath (varchar)
- bannerLink (varchar)
- bannerMsg (varchar)
And the original code for the banner is:
<section id="bannerArea">
<script type="text/javascript">
var imgs1 = new Array("images/banner/banner1.jpg","images/banner/banner2.jpg","images/banner/banner3.jpg","images/banner/banner4.jpg");
var lnks1 = new Array("itunes.html","http://www.tees-su.org","http://jotformeu.com/31343187796362","presenters.php");
var alt1 = new Array("Download our iTunes app now!","We're at Final Fling!","Give your feedback on our website now!","View our presenters!");
var currentAd1 = 0;
var imgCt1 = 4;
function cycle1() {
if (currentAd1 == imgCt1) {
currentAd1 = 0;
}
var banner1 = document.getElementById('adBanner1');
var link1 = document.getElementById('adLink1');
banner1.src=imgs1[currentAd1]
banner1.alt=alt1[currentAd1]
document.getElementById('adLink1').href=lnks1[currentAd1]
currentAd1++;
}
window.setInterval("cycle1()",7000);
</script>
<a href="itunes.html" id="adLink1" target="_top">
<img src="images/banner/banner1.jpg" id="adBanner1" border="0" width="100%" height="100%"></a>
</section>
I'm just wanting it so that they are uploadable (which I've managed to sort out, so isn't an issue in this matter), and then editable as to whether they're visible and the message/link changeable from the CMS.