' Create filesystemobject
set oFSO = server.createobject("scripting.filesystemobject")
' Create template object
set oTemplate = oFSO.opentextfile(server.mappath(pathfilename),forreading,boolcreatefile)
if err <> 0 then
err.clear
exit function
end if
' Get the whole file as a string
temptemplate = oTemplate.readall
' Encode template to HTML?
if encodetohtml then
gettemplate = tohtml(temptemplate)
else
gettemplate = temptemplate
end if
' Close the template
oTemplate.close
' Free the server resources
set oTemplate = nothing
set oFSO = nothing
end function
' This procedure gets and stores a template
public sub usetemplate(pathfilename)
thistemplate = gettemplate(pathfilename,false)
end sub
' This property replaces tags with the user's template
public property let tag(tagname,userstring)
dim ld, rd 'as string
dim temptag 'as string
dim tagstart, tagend 'as integer
ld = "<!--"
rd = "-->"
tagstart = 1
do while tagstart > 0 and tagstart < len(thistemplate)
tagstart = instr(tagstart,thistemplate,ld)
if tagstart > 0 then
tagend = instr(tagstart,thistemplate,rd)
if tagend > (tagstart + 3) then
temptag = mid(thistemplate,tagstart + 4,tagend-(tagstart+4))
if (t
| 对此文章发表了评论 |
