1. General virtual hosts implemented using adodb.stream are provided
The code copy is as follows:
functionloadtempletfile(byvalpath)
onerrorresumenext
dimobjstream
setobjstream=server.createobject("adodb.stream")
withoutbjstream
.type=2
.mode=3
.open
.loadfromfileserver.mappath(path)
iferr.number<>0then
err.clear
response.write("Preloaded template ["&path&"] does not exist!")
response.end()
endif
.charset=""&chrset&""
.position=2
loadtempletfile=.readtext
.close
endwith
setobjstream=nothing
endfunction
2. Use fso to implement the loading speed of templates, but many virtual hosts do not provide fso functions.
The code copy is as follows:
'*******************************************************************************************************
'Function name: LoadTemplate
'Effect: Take out the template content
'Parameter: TemplateFname template address
'Return value: template content
'********************************************************************************************************
FunctionLoadTemplate(TemplateFname)
onerrorresumenext
DimFSO, FileObj, FileStreamObj
SetFSO=CreateObject("scripting.filesystemobject")