ASP simple Generation static method (template tag replacement) _ Application Tips

Source: Internet
Author: User
Createhtml
All articles generated, easy to use resources large
The first method:
Copy Code code as follows:

' Start HTML Build Way
Set rs=server.createobject ("Adodb.recordset")
Sql= "Select Kqiqi_id,kqiqi_title,kqiqi_pinyin,kqiqi_explain,kqiqi_content,kqiqi_record from KQIQI_CY ORDER by KQIQI_ ID Desc "
Rs.Open sql,conn,1,3
Datanum=rs.recordcount
For i= 1 to Datanum
Title=replace (Replace (Rs (1), CHR, ""), Chr (10), "")
' Start generating idiom files
Set fso=createobject ("Scripting.FileSystemObject")
Set Kqiqi_mb=fso.opentextfile (Server.MapPath ("kqiqi_cy_mb.html"))
Kqiqi_ce=kqiqi_mb.readall
Kqiqi_mb.close
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Title}", "&Title&")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Systemtitle}", "&SystemTitle&")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI:P Inyin}", "" &rs (2) & "")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Explain}", "" &rs (3) & "")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Content}", "" &rs (4) & "")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Record}", "" &rs (5) & "")
Set Kqiqi_we=fso.createtextfile (Server.MapPath ("Html/kqiqicy_" &rs (0) & ". Html"), true)
Kqiqi_we.writeline Kqiqi_ce
Kqiqi_we.close
Set fso=nothing
' Build complete
Rs.movenext
Next
Kqiqicy = kqiqicy & "<table cellspacing=" "0" "cellpadding=" "0" "width=" "he" "align=" "Center" "border=" "0" "Class = "" TD table "" > "& vbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "></TD></TR>" & VbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "class=" "Tdbar" "> Generation Completed </TD></TR>" & VbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "> Customer-Qi idiom dictionary all generated!" <input type= "button" "Name=" "Button1" "Value=" "Return" "onclick=" "Javascript:history.back (-1);" " ></TD></TR> "& VbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "class=" "Tdbar" "> Exit </TD></TR>" & VbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "><a href=" "Kqiqi_admin.asp? Action=quit "" > Exit </a> & VbCrLf
Kqiqicy = kqiqicy & "</TD></TR></FORM></TABLE>" & VbCrLf

The second, seen from other systems,
Copy Code code as follows:

<%
' Copyright 2007
' Creator: Wu
' All rights reserved: Www.sm05.com
' Version: Ver 1.0
' Technical support: Mail: service@sm05.com qq:21275120
%>
<!--#include file= "cyconn.asp"-->
<%
Dim fso
Dim fr
Dim wstr
Dim fw
' Start HTML Build Way
Set Rs=server.createobject ("Adodb.recordset")
Sql= "SELECT * from pic-id DESC"
Rs.Open sql,conn,1,3
Datanum=rs.recordcount
For i= 1 to Datanum
' Start generating idiom files
Set Fso=createobject ("Scripting.FileSystemObject")
Set Fr=fso.opentextfile (Server.MapPath ("chengyu_m.htm"))
Wstr=fr.readall
Fr.close
Dim rstr
Wstr=replace (WSTR, "<{{biaoti}}>", "" "&replace (RS (" Biaoti "), vbNewLine," ") &" ")
Wstr=replace (WSTR, "<{{pinyin}}>", "" "&rs (" SG ") &" ")
Wstr=replace (WSTR, "<{{jieshi}}>", "" "&rs (" JS ") &" ")
Wstr=replace (WSTR, "<{{from}}>", "" "&rs (" Content ") &" ")
Wstr=replace (WSTR, "<{{example}}>", "" "&rs (" Jilu ") &" ")
Set Fw=fso.createtextfile (Server.MapPath ("View/chengyu" &rs ("id") & ". htm"), true)
Fw.writeline WSTR
Fw.close
Set fso=nothing
' Build complete
Rs.movenext
Next
Response.Write "To come to a forum idiom column all generation finished!" "
%>

Makehtml start generation from the specified ID
Copy Code code as follows:

' Start HTML Build Way
Set rs=server.createobject ("Adodb.recordset")
Sql= "Select Kqiqi_id,kqiqi_title,kqiqi_pinyin,kqiqi_explain,kqiqi_content,kqiqi_record from KQIQI_CY ORDER by KQIQI_ ID Desc "
Rs.Open sql,conn,1,3
For I=ID1 to Id2
Title=replace (Replace (Rs (1), CHR, ""), Chr (10), "")
' Start generating idiom files
Set fso=createobject ("Scripting.FileSystemObject")
Set Kqiqi_mb=fso.opentextfile (Server.MapPath ("kqiqi_cy_mb.html"))
Kqiqi_ce=kqiqi_mb.readall
Kqiqi_mb.close
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Title}", "&Title&")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Systemtitle}", "&SystemTitle&")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI:P Inyin}", "" &rs (2) & "")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Explain}", "" &rs (3) & "")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Content}", "" &rs (4) & "")
Kqiqi_ce=replace (Kqiqi_ce, "{$KQIQI: Record}", "" &rs (5) & "")
Set Kqiqi_we=fso.createtextfile (Server.MapPath ("Html/kqiqicy_" &rs (0) & ". Html"), true)
Kqiqi_we.writeline Kqiqi_ce
Kqiqi_we.close
Set fso=nothing
' Build complete
Rs.movenext
Next
Kqiqicy = kqiqicy & "<table cellspacing=" "0" "cellpadding=" "0" "width=" "he" "align=" "Center" "border=" "0" "Class = "" TD table "" > "& vbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "></TD></TR>" & VbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "class=" "Tdbar" "> Generation Completed </TD></TR>" & VbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "> guest-Qi idiom dictionary generation complete!" <input type= "button" "Name=" "Button1" "Value=" "Return" "onclick=" "Javascript:history.back (-1);" " ></TD></TR> "& VbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "class=" "Tdbar" "> Exit </TD></TR>" & VbCrLf
Kqiqicy = kqiqicy & "<tr><td align=" "Center" "><a href=" "Kqiqi_admin.asp? Action=quit "" > Exit </a> & VbCrLf
Kqiqicy = kqiqicy & "</TD></TR></FORM></TABLE>" & VbCrLf
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.