'/////////////////////////////////////// //////////////
'Example of generating static pages using a template
'Author: griefforyou
'/////////////////////////////////////// //////////////
<! -- File (template.htm) -->
<HTML>
<Head>
<Title> % title % </title>
</Head>
<Body>
% Content %
</Body>
</Html>
<! -- Testtemplate. asp -->
<%
Dim FSO, F
Dim strtitle, strcontent, Strout
'Create a File System Object
Set FSO = server. Createobject ("scripting. FileSystemObject ")
'Open the webpage template file and read the template content
Set F = FSO. opentextfile (server. mappath ("template.htm "))
Strout = f. readall
F. Close
Strtitle = "this is the title of the generated webpage"
Strcontent = "this is the generated webpage content"
'Replace the tag in the template with the actual content
Strout = Replace (Strout, "% title %", strtitle)
Strout = Replace (Strout, "% content %", strcontent)
'Create a static page to generate
Set F = FSO. createtextfile (server. mappath ("new.htm"), true)
'Write webpage content
F. writeline Strout
F. Close
Response. Write "static page generated successfully! "
'Release File System Objects
Set F = nothing
Set FSO = nothing
%>