ASP AdRotator Komponenti


Örnekler:

Basit AdRotator örneği

Bu örnek farklı reklam imajlarının gösteriminde, AdRotator komponentinin nasıl kullanıldığı ile iliglidir.

AdRotator -Resimlerin link olumu

Birinci örneğe ek olarak her bir resim birer hyperlink olarak baskabir url e aciliyor.


ASP AdRotator Bileşeni

AdRotator bileşeni sayfa yeniden yüklendiğinde her seferinde farklı bir resim'in yenilenen sayfada goruınmesi icin adrotator nesnesini kullanır.

Aşağıda yazıldığı gibi.Text dökümanı resimler hakkındaki bilgileri içerir.

Dizim:

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


Örnek

banners.asp adlı bir asp dökümanımız olduğunu düşünelim. Aşağıdaki gibi olsun;

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

"ads.txt"  dosyasıda aşağıdaki gibi olsun.

*
w3schools.gif
http://www.w3schools.com/
Visit W3Schools
80
microsoft.gif
http://www.microsoft.com/
Visit Microsoft
20

* isareti txt dosyasında resimlerin gösterilebileceğini, link adresleri ve alternatif yazının ve % olarak hangi oranda olacağı bilgilierini belirtir.

REDIRECT banners.asp
*
w3schools.gif
http://www.w3schools.com/
Visit W3Schools
80
microsoft.gif
http://www.microsoft.com/
Visit Microsoft
20

Yeniden yönlendirilen  sayfa linkte verilen bir  url değeri ile o sayfaya yonlendirilir.

Not: Yeniden yönlendirilen sayfadan sonra takip eden satırlarda  imajın kalınlığını,genişliği ve yüksekliği belirtebilirsiniz.

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

Son olarakta banners asp sayfasına bazı asp satırları cs. eklenebilirnir;

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

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

Hepsi buymuş.!


Properties

Property Description Example
Border Reklamın etrafındaki cizgilerin kalınlığını belirtir.

 

<%
set adrot=Server.CreateObject("MSWC.AdRotator")
adrot.Border="2"
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>
Clickable Reklam bannerının  clik olup olamayacağını bildirmemizi sağlar. <%
set adrot=Server.CreateObject("MSWC.AdRotator")
adrot.Clickable=false
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>
TargetFrame Reklamın gösterileceği çerçevenin ismidir.

 

<%
set adrot=Server.CreateObject("MSWC.AdRotator")
adrot.TargetFrame="target='_blank'"
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>

Methods

Method Description Example
GetAdvertisement Sayfada gösterilen reklamın html kodunu döndürür. <%
set adrot=Server.CreateObject("MSWC.AdRotator")
Response.Write(adrot.GetAdvertisement("ads.txt"))
%>


 

Kaynak: http://www.w3schools.com