The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Adding a Rotating Banner/Ad to VBAdvanced CMPS Details »» | |||||||||||||||||||||||||||
Adding a Rotating Banner/Ad to VBAdvanced CMPS
Developer Last Online: Nov 2023
This will add an advertisement to all your VBAdvanced CMPS pages.
So here you go: In the style manager edit the template "adv_portal" Find Code:
<body> Code:
<body onLoad="ranImage();window.status='YOUR SITES NAME';"> Add a new template named "adv_portal_advertisement" Copy this into it and update it to link to your images and URLS: Code:
<!-----Banner ads--------> <SCRIPT LANGUAGE="JavaScript"> pix=new Array("http://www.YOUR-IMAGE-LINK-1","http://www.YOUR-IMAGE-LINK-2","http://www.YOUR-IMAGE-LINK-3") ; links=new Array("http://www.URL-FOR-IMAGE-1","http://www.URL-FOR-IMAGE-2","http://www.URL-FOR-IMAGE-3") ; imCt=pix.length; function ranImage(){ ran=Math.floor(Math.random()*imCt); document.images["image"].src=pix[ran]; document.getElementById("IMFbanner") .href=links[ran]; } </script> <!----- ads-----------> <table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%"> <tr> <td class="tcat"><b><DIV ALIGN=CENTER>Advertisement</b></div></td> </tr> <tr> <td class="alt1" align="center"><BR> <a href="http://www.URL-FOR-IMAGE-1" id="IMFbanner" target="_blank"><img src="http://www.YOUR-IMAGE-LINK-1" name="image" border="0"></a> <BR> </td> </tr> </table> <br /> <!-----end ads-----------> <!-----End Banner ads--------> Title: Advertisement Template to include: advertisement Active: Yes you MUST tick YES to updating all pages or you will get an error. Show Your Support
|
Comments |
#2
|
|||
|
|||
Or you could just add it to the header of footer og the adv_portal templates which are already there
|
#3
|
||||
|
||||
If it is its own module you can move it anywhere and use button sized banners if you want. If it's in the footer that's where it stays...
|
#4
|
||||
|
||||
Is there a way to get this to work by using two modules in CMPS? I want to have two modules displaying radom adds but I tried it and only one will rotate.
|
#5
|
||||
|
||||
Quote:
id="IMFbanner" id="IMFbanner2" |
#6
|
|||
|
|||
I am trying to use a version of this to put a rotating image inside a vBa CMPS Module and I am not quite clear what I am doing wrong or how this works (I am not a Java person yet)...
That I did was I created a template "adv_portal_advertisement" Which says: Quote:
From there I created a Template module that calls the above template... When I run this, the only part of the above script that runs is the part in the: Code:
<td class="tcat"><b><DIV ALIGN=CENTER>Advertisement</b></div></td> </tr> <tr> <td class="alt1" align="center"><BR> <a href="http://www.URL-FOR-IMAGE-1" id="IMFbanner" target="_blank"><img src="http://www.YOUR-IMAGE-LINK-1" name="image" border="0"></a> <BR> </td> Code:
<!----- ads-----------> <table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%"> <tr> <td class="tcat"><b><DIV ALIGN=CENTER>Advertisement</b></div></td> </tr> <tr> <td class="alt1" align="center"><BR> <a href="http://www.URL-FOR-IMAGE-1" id="IMFbanner" target="_blank"><img src="http://www.YOUR-IMAGE-LINK-1" name="image" border="0"></a> <BR> </td> </tr> </table> <br /> <table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%"> <tr> <td class="tcat"><b><DIV ALIGN=CENTER>Advertisement</b></div></td> </tr> <tr> <td class="alt1" align="center"><BR> <a href="http://www.URL-FOR-IMAGE-2" id="IMFbanner" target="_blank"><img src="http://www.YOUR-IMAGE-LINK-2" name="image" border="0"></a> <BR> </td> </tr> </table> <br /> <!-----end ads-----------> |
#7
|
|||
|
|||
This looks just what I need
But I cannot find <body> in the adv_portal When I add the module, I just get an X where the image cannot be found Hope you can help Cheers Ste PirateRevival.co.uk |
#8
|
|||
|
|||
changed <body> still no joy : (
|
#9
|
|||
|
|||
I wanted to have some banners having links and some others not, not all companies that I wanted to advertise have webpages, I have changed the script in order to be able to have both options: banners with links and banners without links. If in the array of links "links" you put, instead of an URL, the character "#" then the related banner will not have an a tag. Use the following code for that:
<tr><td style="padding-left:0px; padding-top:0px; padding-bottom:0px; padding-right:0px;"> <SCRIPT LANGUAGE="JavaScript"> //create arrays for pix and links pix=new Array("http://www.link1.com/image1.jpg","http://www.link1.com/image2.jpg","http://www.link1.com/image3.jpg") ; links=new Array("#","http://www.link1.com/","http://www.link2.com/"); //calculate pix array length imCt=pix.length; function ranImage(){ //pic random array entry (image) ran=Math.floor(Math.random()*imCt); //get div element var div1= document.getElementById("IMFbanner"); if (links[ran]=="#"){ //no link available var newdiv = document.createElement('img'); newdiv.setAttribute('src', pix[0]); newdiv.setAttribute('name', 'image'); newdiv.setAttribute('border', 0); } else //link available { var newdiv = document.createElement('a'); newdiv.setAttribute('href', links[ran]); newdiv.setAttribute('target', '_blank'); newdiv.innerHTML="<img src='"+ pix[0] +"' name='image' border='0'>"; } //create elements div1.appendChild(newdiv); document.images["image"].src=pix[ran]; } </SCRIPT> <span id="IMFbanner"></span> </td> </tr> |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|