Back to vBulletin 3.5 Add-ons

Another Javascript VBA CMPS Banner Rotation Solution
Mod Version: 1.00, by Quarterbore

This modification is in the archives.
vB Version: 3.5.2 Rating: (0 vote - 0 average) Installs: 1
Released: 29 Mar 2006 Last Update: Never Downloads: 0
Not Supported Additional Files Is in Beta Stage  

I have been fighting with a number of the various Javascript based banner rotations on the board and I seemed to keep having problems. My solution was to stubbornly give up and turn to our friends at Google.com. A quick google search uncovered this little script so the author of this page deserves credit for making this work:

http://www.yugdesign.com/demo/Ad-Simple/index.html

With the script above, I simply set out to create a module for my website that would allow me to present a random book with an amazon affiliate link.

Step 1: Create the PHP File, save in /forums/modules/books.pdf

PHP Code:
<tr><td><table bgcolor="white" width=100%><tr><td><center>
<
SCRIPT language=JavaScript>
/*
 +---------------------------------------------------------+
 | Ad Simple                 Copyright [url]www.YugDesign.com[/url]   |
 +---------------------------------------------------------+
 | This program may be used and hosted free of charge by   |
 |anyone for personal purpose as long as this copyright    |
 |notice remains intact.                                   |
 +---------------------------------------------------------+
*/

var img_width "150";
var 
img_height "230";
var 
img_title "Click Here";


var 
ad=new Array()
//insert here your images src
ad[0]='http://www.mydomain.com/books/book1.jpg'
ad[1]='http://www.mydomain.com/books/book2.jpg';
ad[2]='http://www.mydomain.com/books/book3.jpg'
ad[3]='http://www.mydomain.com/books/book4.jpg';  
ad[4]='http://www.mydomain.com/books/book5.jpg'
ad[5]='http://www.mydomain.com/books/book6.jpg';

var 
links=new Array()
//insert here your links
links[0]='http://www.amazon.com/affiliate_link_1; 
links[1]='
http://www.amazon.com/affiliate_link_2; 
links[2]='http://www.amazon.com/affiliate_link_3; 
links[3]='
http://www.amazon.com/affiliate_link_4; 
links[4]='http://www.amazon.com/affiliate_link_5; 
links[5]='
http://www.amazon.com/affiliate_link_6; 

var xy=Math.floor(Math.random()*ad.length);
document.write('<a href="'+links[xy]+'" target="_blank"><img src="'+ad[xy]+'" width="'+img_width+'" height="'+img_height+'" alt="'+img_title+'"></a>');
</
SCRIPT>
</
center></td></tr></table></td></tr
Then, create a new CMPS Module:

>>Add Module >> PHP File

Module Title: Related Books
File to Include: books.php
Identifier: books
Clean File Output: yes
Use Module Shell Template: Yes

Other notes: I upload photos of the books that I feature to my server as it is more reliable for me and it allows me to resize images to about the size that this script requires. This code could be used in many other ways.

You can see this running on my website at:

http://www.timeshareforums.com

Edits:

29-Mar-2006: Changed Title from Java to Javascript

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2025