%Option Explicit%> <% dim fso dim nRow dim nCol set fso = Server.CreateObject("Scripting.FileSystemObject") Function GetForSaleAd(ByVal nRow, ByVal nCol) GetForSaleAd = GetAd(nRow, nCol, _ "Data\Ads\ForSale\ForSale", _ "
Advertise your personal items for sale here.
" & _ "No sale - no fee!") End Function Function GetWantedAd(ByVal nRow, ByVal nCol) GetWantedAd = GetAd(nRow, nCol, _ "Data\Ads\Wanted\Wanted", _ "
Looking for something? Advertise here
" & _ "No purchase - no fee!") End Function Function GetAd(ByVal nRow, ByVal nCol, ByVal strRootFileName, strDefaultContent) dim ts, strPathName, strLine, bHeader, nAdId nAdId = ((nRow - 1) * 4) + nCol strPathName = Server.MapPath(strRootFileName) & nAdId & ".txt" if not fso.FileExists(strPathName) then GetAd = strDefaultContent exit function end if bHeader = True Set ts = fso.OpenTextFile(strPathName, 1) Do While Not ts.AtEndOfStream strLine = Server.HTMLEncode(ts.ReadLine) if strLine <> "" then if bHeader then bHeader = False GetAd = "
" & strLine & "
" else GetAd = GetAd & "" & strLine & "
" end if end if Loop End Function %>
|
|
||||||||||||||||||||
|