ASP AdRotator 구성 요소


ASP AdRotator 구성 요소

ASP AdRotator 구성 요소는 사용자가 페이지를 입력하거나 새로 고칠 때마다 다른 이미지를 표시하는 AdRotator 개체를 만듭니다. 텍스트 파일에는 이미지에 대한 정보가 포함되어 있습니다.

참고: AdRotator는 Internet Information Server 7(IIS7)에서 작동하지 않습니다.

통사론

<%
set adrotator=server.createobject("MSWC.AdRotator")
adrotator.GetAdvertisement("textfile.txt")
%>

ASP AdRotator 예

"ads.txt"라는 다음 텍스트 파일이 있다고 가정합니다.

REDIRECT banners.asp
*
w3s.gif
https://www.w3schools.com
Free Tutorials from W3Schools
50
xmlspy.gif
https://www.altova.com
XML Editor from Altova
50

위의 텍스트 파일에서 별표 아래의 줄은 표시할 이미지(광고)의 이름, 하이퍼링크 주소, 대체 텍스트(이미지의 경우) 및 표시 비율(퍼센트)을 지정합니다.

위 텍스트 파일의 첫 번째 줄은 방문자가 이미지 중 하나를 클릭할 때 발생하는 작업을 지정합니다. 리디렉션 페이지(banners.asp)는 리디렉션할 URL이 포함된 쿼리 문자열을 받습니다.

팁: 이미지의 높이, 너비 및 테두리를 지정하려면 REDIRECT 아래에 다음 줄을 삽입할 수 있습니다.

REDIRECT banners.asp
WIDTH 468
HEIGHT 60
BORDER 0
*
w3s.gif
...

"banners.asp" 파일은 다음과 같습니다.

예시

<%
url=Request.QueryString("url")
If url<>"" then Response.Redirect(url)
%>

<!DOCTYPE html>
<html>
<body>
<%
set adrotator=Server.CreateObject("MSWC.AdRotator")
response.write(adrotator.GetAdvertisement("textfile.txt"))
%>
</body>
</html>

그게 다야!!



ASP AdRotator 속성

Property Description Example
Border Specifies the size of the borders around the advertisement <%
set adrot=Server.CreateObject("MSWC.AdRotator")
adrot.Border="2"
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>
Clickable Specifies whether the advertisement is a hyperlink <%
set adrot=Server.CreateObject("MSWC.AdRotator")
adrot.Clickable=false
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>
TargetFrame Name of the frame to display the advertisement <%
set adrot=Server.CreateObject("MSWC.AdRotator")
adrot.TargetFrame="target='_blank'"
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>

ASP AdRotator 메서드

Method Description Example
GetAdvertisement Returns HTML that displays the advertisement in the page <%
set adrot=Server.CreateObject("MSWC.AdRotator")
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>