In actual work, we often use the template, which not only ensures the consistency of each page, but also reduces our workload. This article introduces how to use ASP to read the HTML template method (attached code)
Model page: m.htm
Title: {Title}
Content: {Content}
Call the page xxx.asp
My_moban = loadfile (m.htm)
If my_moban <> then
My_moban = (Replace (My_moban, {Title}, Wulin.com
My_moban = (Replace (my_moban, {content}, http://www.vevb.com))
Response.write my_moban
end if
Function loadfile (m_root)
DIM FILENAME, FSO, HNDFILE
Filename = m_root
If Right (Filename, 1) <>/ and Right (Filename, 1) <>/ then Filename = FILENAME &//
Filename = server.mappath (FILENAME & M_filename)
Set FSO = CreateObject (scripting.filesystemObject)
If not fso.fileexist (filename) then response.write (template file & m_filename & does
set hndfile = fso.openTextFile (filename)
if not hndfile.atendofstream then
Loadfile = hndfile.readall
end if
Set hndfile = nothing
Set fSO = Nothing
If loadfile = then response.write
End function
The above methods are for reference only.