asp下用实现模板加载的的几种方法总结 <font col(2)
Set FSO = CreateObject("scripting.filesystemobject")
TemplateFname = Server.MapPath(Replace(TemplateFname, "//", "/"))
If FSO.FileExists(TemplateFname) = False Then
LoadTemplate = "模板不存在,请先绑定!"
Else
Set FileObj = FSO.GetFile(TemplateFname)
Set FileStreamObj = FileObj.OpenAsTextStream(1)
If Not FileStreamObj.AtEndOfStream Then
LoadTemplate = FileStreamObj.ReadAll
Else
LoadTemplate = "模板内容为空"
End If
End If
Set FSO = Nothing:Set FileObj = Nothing:Set FileStreamObj = Nothing
LoadTemplate=LoadTemplate & Published
End Function
'**************************************************
ASP使用FSO读取模板的代码
3、还有一种就是把模板放到数据库中(速度慢)