Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - banner advertising
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

banner advertising

 Post Reply Post Reply
Author
alabamatoy View Drop Down
Groupie
Groupie


Joined: 04 February 2006
Location: United States
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote alabamatoy Quote  Post ReplyReply Direct Link To This Post Topic: banner advertising
    Posted: 19 October 2008 at 12:50pm
My understanding of the license is that if I modify the code, I am supposed to post it back here for others, so here goes.
 
I wanted a randomly selected banner ad mechanism.  This mod allows use of a banner images located immediately to the right of the forum image on each page.  The images are in a single folder, and an image is randomly selected from the coded list of images and associated links.
 
First create a new folder under the webwize forum folder called "bannerimages".  Place whatever image files are to be used therein.  This code example is based upon the forum being in a folder called "forum".
 
Replace /forum/includes/header.asp with the following:
 
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script language="javascript" src="includes/default_javascript_v9.js" type="text/javascript"></script>
</head>
</head>
<body>
<table class="basicTable" cellspacing="0" cellpadding="3" align="center">
 <tr>
  <td><%
  
'If there is a forum image then dsiplay it
If NOT strTitleImage = "" Then Response.Write("<a href=""" & strWebsiteURL & """><img src=""" & strTitleImage & """ border=""0"" alt=""" & strWebsiteName & " " & strTxtHomepage & """ title=""" & strWebsiteName & " " & strTxtHomepage & """ /></a>")
%></td>
 
<!--select random banner image to display to the right of the forum image and associated link-->
<td><%
Dim strarrayimage(3), strarraylink(3)
Dim randomval
 
'enter names of random banner images
strarrayimage(0) = "/forum/bannerimages/2_star_rating.png"
strarrayimage(1) = "/forum/bannerimages/3_star_rating.png"
strarrayimage(2) = "/forum/bannerimages/4_star_rating.png"
strarrayimage(3) = "/forum/bannerimages/5_star_rating.png"
 
'enter links associated with above listed files
strarraylink(0) = "
http://www.link2"
strarraylink(1) = "
http://www.link3"
strarraylink(2) = "
http://www.link4"
strarraylink(3) = "
http://www.link5"
 
randomval = Int(Rnd(1)*UBound(strarrayimage))
Response.Write("<a href=""" & strarraylink(randomval) & """><img src=""" & strarrayimage(randomval) & """ ></a>")
%>
</td>
 </tr>
</table>
In this example, I used the 2, 3, 4 and 5 star images just as example files to give it something to display.  Use your own image files there as values of strarrayimage.  Change the DIM statement for strarraylink and strarrayimage to align with however many images you have.  Enter the link you want the user sent to if he clicks on the displayed banner image in strarraylink.
 
This code will randomly pick one of the listed banner images, display it, and hyperlink it to the associated correct link.  It seems to work well.  You will need to work on the image files to make them the correct size etc so that they will display correctly....or you probably could modify the response.write to force the display to the desired size etc.  Also may want to modify it to force the browser to open the page in a new window.
 
HTH........
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.