Componente ASP AdRotator
Componente ASP AdRotator
El componente ASP AdRotator crea un objeto AdRotator que muestra una imagen diferente cada vez que un usuario ingresa o actualiza una página. Un archivo de texto incluye información sobre las imágenes.
Nota: AdRotator no funciona con Internet Information Server 7 (IIS7).
Sintaxis
<%
set adrotator=server.createobject("MSWC.AdRotator")
adrotator.GetAdvertisement("textfile.txt")
%>
Ejemplo de ASP AdRotator
Supongamos que tenemos el siguiente archivo de texto, llamado "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
Las líneas debajo del asterisco en el archivo de texto anterior especifican el nombre de las imágenes (anuncios) que se mostrarán, las direcciones de los hipervínculos, el texto alternativo (para las imágenes) y las tasas de visualización (en porcentaje).
La primera línea del archivo de texto anterior especifica qué sucederá cuando un visitante haga clic en una de las imágenes. La página de redirección (banners.asp) recibirá una cadena de consulta con la URL a la que redirigir.
Sugerencia: para especificar la altura, el ancho y el borde de la imagen, puede insertar las siguientes líneas debajo de REDIRECT:
REDIRECT banners.asp
WIDTH 468
HEIGHT 60
BORDER 0
*
w3s.gif
...
El archivo "banners.asp" se ve así:
Ejemplo
<%
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>
¡¡Eso es todo!!
Propiedades del rotador de anuncios ASP
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")) %> |
Métodos AdRotator ASP
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")) %> |