Spørgsmål vedr. DB.
Er det muligt i nedenstående script, at trække bannerne ud af en DB. fremfor som her en textfil. Er det et større projekt?Mvh. Den uerfarne
Rene
<%
strSep = "#" ' Separator til arrays
' Her tilføjes banner nr. 1
arrBannerPic = arrBannerPic & strSep & "banner/image703.gif"
arrBannerSize = arrBannerSize & strSep & "158*58"
arrBannerURL = arrBannerURL & strSep & "http://www.-.com"
' Her tilføjes banner nr. 2
arrBannerPic = arrBannerPic & strSep & "banner/image764.gif"
arrBannerSize = arrBannerSize & strSep & "158*58"
arrBannerURL = arrBannerURL & strSep & "http://www.-.dk"
' Split arrays
arrBannerPic = Split(arrBannerPic,strSep)
arrBannerSize = Split(arrBannerSize,strSep)
arrBannerURL = Split(arrBannerURL,strSep)
arrBannerID = Split(arrBannerID,strSep)
Function Banner(strformat)
' Find de bannere som har det rigtige format.
For intBanner = 1 to Ubound(arrBannerID)
If arrBannerSize(intBanner) = strformat Then
arrBanners = arrBanners & strSep & intBanner
End If
Next
arrBanners = Split(arrBanners,strSep)
' Vælg tilfældigt banner.
Randomize
intRandom = Int((Ubound(arrBanners) * Rnd) + 1)
intShow = arrBanners(intRandom)
arrSize = Split(arrBannerSize(intShow),"x")
Response.Write "<a href='" & arrBannerURL(intShow) & "'>"
Response.Write "<img src='" & arrBannerPic(intShow) & "' alt='Klik her for mere information!' "
Response.Write "<img src='" & arrBannerID(intShow) & "'"
Response.Write "width='" & arrSize(0) & "' height='" & arrSize(1) & "' border='1' bordercolor='#ffffff'>"
End Function
%>