Fso| Tutorials | application examples
End FSO Application Instance-FSO Tutorial 8
Through the previous 8 relevant FSO detailed tutorials, we combine the following things, make a simple production of HTML article system, contains the file title and content, and with modify article function.
Include file:
Addarticle.html ' article content entry form file
Modiarticle.asp ' Modify file content file
Savearticle.asp ' Save new content file
In order to facilitate the tutorial demo, we in the source code unified generated Html file named "fsotohtml.html"
' Addarticle.html source code
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Add new articles </title>
<body>
<form method= "POST" name= "Thefrm" action= "savearticle.asp" >
Article title: <input name= "title" type= "text" value= "" size= ">
Article content: <br/>
<textarea name= "Content" cols= "rows=" ></textarea>
<br/>
<input type= "Submit" name= "Submit" value= "FSO generate write HTML"/>
</form>
</body>
' Savearticle.asp source
<%
'================================================
' Author: Arisisi
' URL: http://www.alixixi.com/
' Source: FSO generates an HTML file sample
' Time: December 17, 2005
'================================================
Set fs = Server.CreateObject ("Scripting.FileSystemObject")
File = Server.MapPath ("fsotohtml.html")
Set txt = fs. OpenTextFile (File,2,true)
Htmlfile = "article title:" &request.form ("title") & "Txt. Write Htmlfile
Set fs = Nothing
Response.Write "<a href=" "fsotohtml.html" "> Successfully generated File" &File& "</a><p>"
Response.Write "<a href=" "modiarticle.asp" > Modify HTML file Content </a> "
%>
Modiarticle.asp ' source
<%
' ================================================
' Author: Arisisi
' URL: http://www.alixixi.com/
' Source: FSO Modify the generated HTML file example
' time: December 17, 2005
' ================================================
Set fs = Server.CreateObject ("Scripting.FileSystemObject")
File = Server.MapPath ("fsotohtml.html")
Set txt = fs. OpenTextFile (file,1,true)
If not txt.atendofstream Then
content = txt. ReadAll
End If
Set fs = Nothing
title = Split (Content, " text = Split (content, "%>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Add new article </title>
<body>
<form action= "savearticle.asp" method= "post" name= "Thefrm" >
Article title:
<input name= "Title" type= "text" value= "<%=Title%>" size= ">"
Article content: <br/>
<textarea name= "Content" cols= "rows=" ><%=Text%></textarea>
<br/>
<input type= "Submit" name= "Submit" value= "FSO generate write HTML"/>
</form>
</body>
Through the above three files, we have implemented the generation of HTML files, and with the modification function of the small article system. Come on, let's do it.
To this end, the FSO tutorial is finished, and through these 9 basic articles, extrapolate, you can write more powerful FSO applications or generic classes out. If you have any suggestions or comments on this tutorial, please feel free to comment on this website or forum.
Arisisi
Http://www.alixixi.com
December 17, 2005