Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
Adding a Rotating Banner/Ad to VBAdvanced CMPS Details »»
Adding a Rotating Banner/Ad to VBAdvanced CMPS
Version: 1.00, by Roms Roms is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 10-28-2004 Last Update: Never Installs: 3
 
No support by the author.

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>
Replace with

Code:
<body onLoad="ranImage();window.status='YOUR SITES NAME';">
Save and Close

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-------->
Add Module in VBA CMPs

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

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 10-29-2004, 05:07 AM
Blam Forumz Blam Forumz is offline
 
Join Date: Jun 2004
Posts: 554
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Or you could just add it to the header of footer og the adv_portal templates which are already there
Reply With Quote
  #3  
Old 10-29-2004, 03:28 PM
Roms's Avatar
Roms Roms is offline
 
Join Date: Jun 2004
Location: Witness ProtectionProgram
Posts: 1,841
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #4  
Old 06-25-2005, 09:40 AM
attroll's Avatar
attroll attroll is offline
 
Join Date: Jan 2003
Location: Litchfield, Me
Posts: 664
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 07-21-2005, 08:29 PM
Roms's Avatar
Roms Roms is offline
 
Join Date: Jun 2004
Location: Witness ProtectionProgram
Posts: 1,841
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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.
Give each module different id names so they don't conflict....

id="IMFbanner"
id="IMFbanner2"
Reply With Quote
  #6  
Old 03-28-2006, 12:16 PM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
<tr><td>
<!-----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-------->
</td></tr>
(Note, same script above but as part of a module it needs to put inside a TR)

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>
How do I add multiple ads to the above? When I try to add a second table to the ads section I get two images one on top of the other and they do not rotate... for example:

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----------->
Reply With Quote
  #7  
Old 02-08-2008, 12:47 PM
piraterevival piraterevival is offline
 
Join Date: Jan 2008
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 02-08-2008, 11:08 PM
piraterevival piraterevival is offline
 
Join Date: Jan 2008
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

changed <body> still no joy : (
Reply With Quote
  #9  
Old 07-31-2008, 08:59 PM
aphnea aphnea is offline
 
Join Date: Jun 2008
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:17 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04102 seconds
  • Memory Usage 2,287KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete