Thank you for downloading this script, this document demonstrates the banner script and provides simple installation instructions.
1. Add the banners and settings
Further on down you'll find a list of banners, banners take the following syntax:
new banner('website_name', 'website_url', 'banner_url', 'show_until_date', 'adlocation'),
They should be added below the "var banners = [" code on line 67.
Important: There should be a comma at the end of each banner, as in the above code, APART from the last one!
Website name, URL and Banner URL should be straight forward. Show until date is a date, in format DD/MM/YYYY, after which the banner will no longer show. This value is required - if you always want a banner to show, simply set it far in the future.
adlocation can be used to assign a banner to a specific location on your page, e.g. if you want one banner rotator at the top of your page and one at the bottom and you want to display specific banners in each location.
If you leave this option empty (make sure to leave the quotes though) then the banner will show in any "empty" location on your page - more about this in the next section though.
Save and upload the file to your server
2. Add banners code
Next you need to add the banners.min.js file to your page using the following line of HTML - make sure to put it between the <head></head> tags
Now you need to add the banners code to your website where you want the banners to display, this takes the following format:
adLocationName sets a name to ads at that location. The name refers to the adlocation name on the banners list earlier. For example, the below code:
...will show all the banners from the list which have an adlocation name of "sidebar_300x200"
Leaving the adLocationName blank will result in any banners in the list which also don't have an assigned adlocation being displayed. You can also mix and match and have some locations with adLocationNames and others without. For example, this banner:
...has the following code...
...and will show all banners which have not been assigned to a specific location. In this demo that is only the one!
You can also use the same adLocationName more than once on the same page, for example you may want to show two 125x125 banners in your sidebar so you could use the following code:
This will pick two random banners from all those which have been assigned to the "sidebar_125x125" adlocation
To upgrade from version 1.2.x or 1.0.x you will need to open banners.min.js and transfer your settings and banner lists over to the new format manually.
The old show_banners code will continue to work and will show all banners in all locations. If you want to take advantage of the new adlocation features you'll have to edit the show_banners code already on your pages to include an adLocationName as described above.
Upload the new banners.min.js file to your site, overwriting the previous one.
This script is free and open source, it has been released under the GPLv2
If you feel this script is worth it, you can leave a link back to my site (below) or send in a small donation for a beer
If you would like to support this and other scripts you also sign up and visit any of the banners on this page!
If you sign up to DreamHost you can use the promocode awesome50 to get $50 off your order!
- Author's site
- Support forum (also for bugs, feedback and features)