12.1 Ad (Advertisement) Rotator

The Ad Rotator component automates the rotation of advertisement images on a Web page. Each time a user opens or reloads the Web page, this component displays a new advertisement based on the information specified in the Ad Rotator Schedule file.

12.1.1 Ad Rotator Schedule File

The Ad Rotator Schedule file contains information that the Ad Rotator component uses to manage and display the various advertisement images. This file stores the size of the advertisement space, the image files to be loaded and the display time (in percentage) for each advertisement. This file can store a maximum of 1000 advertisements.

The Ad Rotator Schedule file has two sections: The first section contains a set of optional parameters that are common to all advertisement images in the rotation schedule. Each parameter contains a keyword and a value. If no values are specified for the global parameter, the Ad Rotator uses default values. The first line of the file must contain a single asterisk (*), when these parameters are not specified. If any of the parameters are set more than once, the last set value is used.

The second section specifies file and location information for individual advertisements and the display time (in percentage) for each advertisement. The two sections are separated by a line containing a single asterisk (*). For more details See Syntax .

12.1.2 Syntax

Following is the syntax of the Ad Rotator Schedule file:

 [REDIRECT RedirectURL]
 [WIDTH Width]
 [HEIGHT Height]
 [BORDER Border]
 *
 AdURL
 AdHomePageURL
 Text
 Probability
 

12.1.3 Parameters

RedirectURL
Specifies the path to the script file that implements redirection. This path can be absolute or relative.
Width
Specifies the width of the advertisement on the page, in pixels. The default value is 440.
Height
Specifies the height of the advertisement on the page, in pixels. The default value is 60.
Border
Specifies the hyperlink border size around the advertisement, in pixels. The default value is 1.This can be overridden by specifying the value in the Ad Rotator Schedule File, which can further be overridden by setting the attribute value in the script.
AdURL
The location of the advertisement image file. You can specify the location either as an URL, absolute, or relative path.
AdHomePageURL
The URL of the advertiser’s home page. If the advertiser does not have a home page, a hyphen (-) can be used on this line to indicate that there is no link for this advertisement.
Text
Alternate text that is displayed if the browser does not support graphics or has its graphics capabilities turned off.
Probability
A number between 0 and 10000 that indicates the relative weight of the advertisement. If the value is 0, the content entry will be ignored.

For example, if a Ad Rotator Schedule file contains three ads with weights set to 4, 7, and 9, the first advertisement has a probability of 20 percent, the second has 35 percent, and the third has 45 percent.

12.1.4 Remarks

The Ad Rotator object uses the last defined values for the following four parameters:

  • REDIRECT
  • WIDTH
  • HEIGHT
  • BORDER

12.1.5 Example

The following is a sample Ad Rotator Schedule file to display a variety of advertisements, with redirection.

 ADROT.TXT
 
 REDIRECT /nsp/adredir.htm
 WIDTH 500
 HEIGHT 100
 BORDER 0
 *
 images/banner1.gif
 http://www.novell.com/netware5
 NetWare 5 - The No.1 NOS
 20
 images/banner2.gif
 http://www.novell.com/bordermanager/
 BorderManager - Improves internet browsing efficiency
 20
 images/banner3.gif
 http://www.novell.com/nds/
 NDS - Truly cross-platform
 60
 

12.1.6 Object Diagram

Describes  the hierarchy of various objects in the Advertisement (Ad) Rotator  component

12.1.7 AdRotator Object

The AdRotator object automates the rotation of advertisement images on a Web page.

12.1.8 Border property

Defines the border size of the advertisement image to be displayed.

Syntax

 Object.Border(
   BorderSize As Integer)
 

Type

Integer.

Attributes

Read/write.

Remarks

By default the value is 1.This value will be a overridden by the value set in the Ad Rotator Schedule file.

Example

For more details about border property see Example.

NOTE:All the scripts should be embedded in a HTML page and saved with .asp extension in a folder under /DOCS. For more details about NSP see Creating NSP Scripts and Executing NSP scripts

12.1.9 Clickable property

Sets the advertisement image to be a hyperlink.

Syntax

 Object.Clickable(
    Value As Boolean)
 

Type

Boolean.

Attributes

Read/write.

Example

For more details on Clickable property see Example.

12.1.10 TargetFrame property

Specifies the name of the frame into which the hyperlinked page is to be loaded.

Syntax

 Object.TargetFrame(
    Name As String)
 

Type

String. Specifies the name of the frame in which the ad image is to be displayed.

Attributes

Read/write.

Remarks

The parameter can also be one of the HTML frame attributes, such as _TOP, _New, _CHILD, _SELF, _PARENT, or _BLANK. The default value is NO FRAME.

Example

For more details on TargetFrame property see Example .

12.1.11 GetAdvertisement method

Gets the specifications from the Ad Rotator Schedule file and returns the HTML output for the next scheduled advertisement.

Syntax

 object.GetAdvertisement(
   AdRotatorScheduleFilePath As String)
 

Parameters

AdRotatorScheduleFilePath
Location of the Ad Rotator Schedule file.

Return Values

String. This is the set of HTML tags required by the browser to display the next advertisement.

Remarks

The advertisements are chosen randomly. The probability is defined by the weight value specified as Probability in the Ad Rotator Schedule file. See Syntax for details.

Example

This example gets an advertisement from "Adrot.txt" file and displays it in the web page based on the specified bordersize, frame details and clickable property.

 <% 
 ’Displays an advertisement without a border.
 Set Ad = CreateObject("MSWC.AdRotator")
 ’Sets the bordersize of the ad image
 Ad.Border = 0
 ’Enables the hyperlink characteristic of the ad image Ad.Clickable = TRUE
 ’Sets the name of the frame in which the ad image is displayed.
 Ad.TargetFrame = "NewFrame" %>
 <%= Ad.GetAdvertisement("adrot.txt") %>
 

NOTE:The argument in the CreateObject call may also be "UCX:AdRotator".

NOTE:If the ad rotator schedule file and the asp are not located in the same folder, the full path should be given for the adrot.txt file. For example if the ADROT.TXT is located in a folder SCH under /DOCS and the asp file is located in the folder ADVERTISE under the folder DOCS, the path for the ADROT.TXT should be given as SYS:/NOVONYX/SUITESPOT/DOCS/SCH/ADROT.TXT.