asp生成静态文件代码

<%
Dim Rs,SQL,HtmlContent
Dim ChannelRootDir,strInstallDir,strIndexName
Dim flashid,downid,showurl,ErrMsg
Dim strTitle,strAddress,addTime
Dim AllHits,Introduce,filesize
Dim HtmlFileUrl,HtmlFileName,strUrl
Newasp.ReadChannel(ChannelID)
ChannelRootDir = Newasp.InstallDir & Newasp.ChannelDir
strInstallDir = Newasp.InstallDir
strIndexName = "<a href='" & ChannelRootDir & "'>" & Newasp.ChannelName & "</a>"
flashid = Newasp.ChkNumeric(Request.Querystring("id"))
If flashid = 0 Then
 OutAlertScript("错误的系统参数!请输入正确的软件ID")
 Response.End
End If
Newasp.LoadTemplates ChannelID, 6, Newasp.ChannelSkin
HtmlContent = Newasp.HtmlContent
HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
HtmlContent = Replace(HtmlContent, "{$InstallDir}", Newasp.InstallDir)
HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
HtmlContent = Replace(HtmlContent, "{$FlashIndex}", strIndexName)
HtmlContent = ReadClassMenu(HtmlContent)
HtmlContent = ReadClassMenubar(HtmlContent)
SQL = "SELECT A.flashid,A.title,A.Introduce,A.filesize,A.downid,A.showurl,A.addTime,A.AllHits,A.HtmlFileDate,A.DownAddress,C.HtmlFileDir FROM NC_FlashList A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID WHERE A.ChannelID="& ChannelID &" And A.isAccept > 0 And A.flashid=" & flashid
Set Rs = Newasp.Execute(SQL)
If Rs.EOF And Rs.BOF Then
 ErrMsg = ErrMsg & "<li>对不起~!没有找到你想下载的软件。</li>"
 Returnerr(ErrMsg)
 Set Rs = Nothing
 Response.End
Else
 strTitle = Rs("title")
 strAddress = Newasp.ChkNull(Rs("DownAddress"))
 showurl = Newasp.ChkNull(Rs("showurl"))
 addTime = Rs("addTime")
 AllHits = Rs("AllHits")
 downid = Rs("downid")
 Introduce = Ubbcode(Rs("Introduce"))
 If CLng(Rs("filesize")) > 0 Then
  filesize = NewCloud.Readfilesize(Rs("fileSize"))
 Else
  filesize = "未知大小"
 End If
 If CInt(Newasp.IsCreateHtml) <> 0 Then
  HtmlFileUrl = ChannelRootDir & Rs("HtmlFileDir") & Newasp.ShowDatePath(Rs("HtmlFileDate"), Newasp.HtmlPath)
  HtmlFileName = Newasp.ReadFileName(Rs("HtmlFileDate"), Rs("flashid"), Newasp.HtmlExtName, Newasp.HtmlPrefix, Newasp.HtmlForm, "")
  strUrl = HtmlFileUrl & HtmlFileName
 Else
  strUrl = ChannelRootDir & "show.asp?id="& Rs("flashid")
 End If
End If
Rs.Close:Set Rs = Nothing
HtmlContent = Replace(HtmlContent, "{$PageTitle}", strTitle)
HtmlContent = Replace(HtmlContent, "{$FlashTitle}", strTitle)
HtmlContent = Replace(HtmlContent, "{$strUrl}", strUrl)
HtmlContent = Replace(HtmlContent, "{$DateAndTime}", addTime)
HtmlContent = Replace(HtmlContent, "{$FleshSize}", filesize)
HtmlContent = Replace(HtmlContent, "{$AllHits}", AllHits)
HtmlContent = Replace(HtmlContent, "{$Introduce}", Introduce)
HtmlContent = Replace(HtmlContent, "{$ShowDownAddress}", ShowDownAddress())
HtmlContent = Replace(HtmlContent, "{$FlashTitle}", strTitle)
HtmlContent = Replace(HtmlContent, "{$FlashID}", flashid)
HtmlContent = Replace(HtmlContent, "{$flashid}", flashid)
HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
HtmlContent = Replace(HtmlContent, "{$SkinPath}", Newasp.SkinPath)
HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
Response.Write HtmlContent
Set NewCloud = Nothing
Public Function ShowDownAddress()
 On Error Resume Next
 
 Dim rsDown,strDownAddress
 Dim i,DownloadPath
 strDownAddress = ""
 If Len(showurl) > 3 Then
  strDownAddress = Newasp.HtmlSetting(3)
  strDownAddress = Replace(strDownAddress, "{$DownLoadName}", "点击立即下载")
  If CInt(Newasp.HtmlSetting(1)) > 0 Then
   strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", NewCloud.FormatShowUrl(showurl))
  Else
   strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", "downfile.asp?url=" & showurl)
  End If
 End If
 If Len(strAddress) > 3 Then
  Set rsDown = Newasp.Execute("SELECT downid,DownloadName,DownloadPath,IsDisp FROM NC_DownServer WHERE ChannelID=" & ChannelID & " And depth=1 And rootid =" & downid & " And isLock=0 ORDER BY orders ASC")
  If Not (rsDown.BOF And rsDown.EOF) Then
   i = 0
   Do While Not rsDown.EOF
    If rsDown("IsDisp") > 0 Then
     DownloadPath = rsDown("DownloadPath") & strAddress
    Else
     DownloadPath = "download.asp?id=" & flashid & "&amp;downid=" & rsDown("downid")
    End If
    strDownAddress = strDownAddress & Newasp.HtmlSetting(3)
    strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", DownloadPath)
    strDownAddress = Replace(strDownAddress, "{$DownLoadName}", rsDown("DownloadName"))
   rsDown.MoveNext
   i = i + 1
   Loop
  Else
   strDownAddress = strDownAddress & Newasp.HtmlSetting(3)
   strDownAddress = Replace(strDownAddress, "{$DownLoadName}", "点击立即下载")
   If CInt(Newasp.HtmlSetting(1)) > 0 Then
    strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", strAddress)
   Else
    strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", "download.asp?id=" & flashid & "&amp;downid=0")
   End If
  End If
  Set rsDown = Nothing
 End If
 ShowDownAddress = strDownAddress
End Function
CloseConn
%>

时间: 2024-08-29 21:35:17

asp生成静态文件代码的相关文章

ASP生成静态文件编码为UTF-8格式的HTML文件_应用技巧

一般我们在ASP环境下,运行动生静操作时都用到的是FSO,他是专门对文件进行操作的一个组件,他FSO的编码属性只有三种,系统默认,Unicode,ASCII,并没有我们要的utf-8,所以一般中文系统上使用FSO组件生成的文件都是gb2312格式的了,即便您在网页内写上charset="utf-8"也是没用的 要生成utf-8格式的文件,ASP环境下我们用 ADODB.Stream代替FSO读写utf-8文件,因为,ADODB.Stream,有一个CharSet 属性,可以让您定义要打

超简单asp生成静态页面代码

<form method="post" action=""> <textarea name="asp2html" style="display:none"><!--#include file="htmer.asp"--></textarea> <input type="submit" value="生成html页"

ASP生成静态文件编码为UTF-8格式的HTML文件

一般我们在ASP环境下,运行动生静操作时都用到的是FSO,他是专门对文件进行操作的一个组件,他FSO的编码属性只有三种,系统默认,Unicode,ASCII,并没有我们要的utf-8,所以一般中文系统上使用FSO组件生成的文件都是gb2312格式的了,即便您在网页内写上charset="utf-8"也是没用的 要生成utf-8格式的文件,ASP环境下我们用 ADODB.Stream代替FSO读写utf-8文件,因为,ADODB.Stream,有一个CharSet 属性,可以让您定义要打

asp生成xml文件代码

 代码如下 复制代码 <!--#include file="config.asp"--> <% Dim Rs,SQL,foundstr Dim classid,ChildStr Dim RssBody,RssTitle,RssHomePageUrl Dim XMLDOM,node,Cnode,Cnode1,msginfo Set XMLDOM = Server.CreateObject("Microsoft.FreeThreadedXMLDOM")

asp 生成feed文件代码

<% function AddSiteURL(ByVal Str)   If IsNull(Str) Then    AddSiteURL = ""    Exit Function   End If   Dim re   Set re=new RegExp   With re     .IgnoreCase =True     .Global=True         .Pattern="<img (.*?)src=""(?!(http|ht

asp.net生成静态页面代码

asp教程.net生成静态页面代码 private static void createfile(string userid, string filename, string htmlcode)         {             filename += ".html";             string localpath = "e:/www.111cn.net/sun/sundecorativesystem/users/" + userid;    

ASP生成静态首页的示例代码

简单点的,ASP生成静态首页的示例代码 <% dim objXmlHttp,binFileData,objAdoStream set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP") objXmlHttp.open "GET","http://"&request.ServerVariables("HTTP_HOST")&"/index1.

ASP生成静态htm页面基本代码!

ASP生成静态htm页面基本代码! 以下虚线框内为mk.asp文件的具体代码: -------------------------------------------------------------------------------- <% filename="test.htm" if request("body")<>"" then set fso = Server.CreateObject("Scriptin

最简单的ASP生成静态HTML页的方法[FSO支持]

下面介绍给大家一个最简单的ASP生成静态HTML页的方法,不用模板也能快速生成.比如要生成一个正常的index.asp页面,并且用ASP代码调出数据库中的内容,另建一个makehtml.asp的页面,加入一个textarea域,假设为name="body",将index.asp在textarea里调出来,如:<textarea name="body"><!--#include file="index.asp"--><