Code implementation:
1. template file (html)
Copy codeThe Code is as follows: <Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> {title}-News Center- jewelry franchise chain </title>
<Meta name = "keywords" content = "{metak }, cool, cool, franchise stores, cool, how to join cool "/>
<Meta name = "description" content = "{metad}, (Hong Kong) ouyi Yi jewelry International Group Co., Ltd. is a company engaged in jewelry, daily necessities, cosmetics, stationery, toys, etc. It has two profit centers: processing plants and chain stores. Hong Kong lingya jewelry company welcomes you to join the chain store. "/>
<Link href = "/css/style_new.css" rel = "stylesheet" type = "text/css"/>
</Head>
<Body>
<Div> <span class = "font_white"> </span> </div>
<! -- Top start -->
<Div> <span class = "font_white"> </span> </div>
<! -- Top start -->
<Div id = "top">
<Div class = "left"> </div>
<Div class = "right">
<Div class = "topuser">
<Form class = "formbox" action = "login_click.asp" method = "post" name = "loginform" id = "loginform" onSubmit = "return checkform2 ()">
<Div style = "line-height: 22px; height: 22px;"> User Name:
<Input name = "uname" type = "text" class = "bot" id = "uname" size = "10" maxlength = "10"/> password:
<Input name = "pwd" type = "password" class = "bot" id = "pwd" size = "10" maxlength = "18"/> <label> </label>
<Input type = "submit" name = "Submit" value = ""/> <INPUT onClick = "Javascript: window. location = '/reg. asp '; "type = button value =" "name = Submit2> </div>
</Form>
</Div>
<Div class = "bottomuser"> <a href = "/index. asp "> homepage </a> | <a href ="/info_qiyejianjie.asp "> enterprise overview </a> | <a href ="/class/"> product presentation </> | <a href = "/news_xinwenzhongxin.asp"> News Center </a> | <a href = "/info_jiamengzhengce.asp"> distribution policy </a> | <a href = "/ info_kaiyedali.asp "> Opening Ceremony </a> | <a href ="/HYPERLINK "> decoration solution </a> | <a href ="/info_xingxiangzhanshi.asp "> Image Display </> | <a href = "/info_jiamengliucheng.asp"> Cooperation Process </a> | <a href = "/info_touziwenda.asp"> Investment Q & a </a> | <a href = "/ zaixianliuyan. asp "> online message </a> </div>
</Div>
</Div>
<! -- Top ends -->
<! -- Ad start -->
<Div id = "subject01"> <a href = "/info_jiamengzhengce.asp" target = "_ blank"> </a> </div>
<! -- Ad end -->
<Div class = "clear"> </div>
<! -- Top ends -->
<! -- Ad start -->
<! -- Ad end -->
<Div class = "clear"> </div>
<! -- Content start -->
<Div id = "main">
<! -- Start on the left -->
<Div class = "left">
<Div class = "top" style = "background: url (/images/fenlei_12_07.jpg);"> </div>
<Div class = "middle">
<Ul>
<Script language = "javascript" src = ".../class. js"> </script>
<Li class = "middle02"> </li>
<Li class = "middle03"> free hotline: 4006-888048 <br>
<Strong> Chinese mainland headquarters: </strong> <br>
Switchboard: 0579-89960888 <br/>
Fax: 0579-85210995 <br>
<Strong> Hong Kong headquarters: </strong> <br>
Tel: 00852-36458129 <br>
Fax: 00852-36458092 </li>
<Li class = "middle04"> </li>
</Ul>
</Div>
<Div class = "bottom"> </div>
<Div class = "leftnews"> </div>
</Div>
<! -- End on the left -->
<Div class = "right">
<Div class = "righttop"> </div>
<Div class = "rightmiddle">
<Ul>
<Li class = "04"> <table width = "700" border = "0" cellpadding = "0" cellspacing = "0" background = "/images/title.jpg">
<Tr>
<Td width = "104" height = "32" align = "center">
<Td width = "596" align = "right"> current location: <a href = "/index. asp"> homepage </a>-News Center </td>
</Tr>
</Table>
<Li class = "02">
<H1 style = "margin: 10px; padding: 2px; font-size: 18px; text-align: center;" >{ title} </Li>
<Li class = "02" style = "text-align: left;" >{demo} </li>
</Li>
</Ul>
</Div>
<Div class = "rightbottom"> </div>
</Div>
</Div>
<! -- Content ended -->
<Div class = "clear"> </div>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Link href = "/css/style_new.css" rel = "stylesheet" type = "text/css"/>
<Div class = "clear"> </div>
<! -- Footer -->
<Table cellspacing = "0" cellpadding = "0" width = "948" align = "center" border = "0">
<Tbody>
<Tr>
<Td valign = "center" align = "middle" width = "79"> <a href = "/info_lianxiwomen.asp"> </a> </td>
<Td width = "869"> <span class = "font_space01"> <a href = "/info_qiyejianjie.asp"> about Iron </a> │ <a href = "/info_jiamengzhengce.asp"> joining policy </a> | <a href = "/info_zhuangxiufangan.asp"> decoration solution </a> | <a href = "/info_jiamengyoushi.asp"> joining advantages </a> | <a href = "/class/"> product display </a> │ <a href = "/zaixianliuyan. asp "> online message </a> │ <a href ="/info_lianxiwomen.asp "> Contact Us </a> │ <a href =" sitemap.html "target =" _ blank "> website Map </a> </span> <br/>
Address of mainland China: building 8, No. 123, Shiyu Road, Yiwu Economic Development Zone, Zhejiang Province (beside Lujiang Middle School), mainland China Hotline: 0579-89960888 free hotline: 4006-888048 <br/>
</Td>
</Tr>
</Tbody>
</Table>
<! -- Footer end -->
<Span style = "visibility: hidden;"> <a href = "http://www.51aiyaya.com" target = "_ blank"> <strong> alas </strong> </a>
<A href = "http://www.51aiyaya.com" target = "_ blank"> </a>
<A href = "http://www.51aiyaya.com" target = "_ blank"> oh ah jewelry </a> <script src = "http://s23.cnzz.com/stat.php? Id = 1117055 & web_id = 1117055 "language =" JavaScript "charset =" gb2312 "> </script> </span>
</Body>
</Html>
2. processed files (asp) Copy codeThe Code is as follows: <! -- # Include file = "conn. asp" -->
<% Server. ScriptTimeOut = 99999999%>
<%
Dim action, id, news
Layout = "news"
Id = request. QueryString ("id ")
Action = request. QueryString ("action ")
Select case action
Case "add"
%>
<%
'Generate html all
Case "htmlall"
Set rs = server. CreateObject ("adodb. recordset ")
SQL = "Select id from news order by id"
Rs. open SQL, conn, 1, 1
Do while not rs. eof
FsoFile "news", rs ("id ")
Response. write "<div style = 'color: #003333; 'align = 'center'>" & rs ("id") & "HTML is generated successfully! </Div>"
Rs. movenext
Loop
Rs. close
Response. write "<div style = 'color: # FF0000; 'align = 'center'> HTML is successfully generated for all news! </Div> </br>"
End select
%>
<%
'Generate Chinese html
Function FsoFile (Layout, ID)
Dim Fso, FilePath, FsoF, FsoH, FsoRs, CreateFilePath
FSOCreateDIR ".. \ news \" & ID &""
CreateFilePath = ".. \ news \" & ID & "" 'Folder where HTML is located
FilePath = Server. Mappath (CreateFilePath) & "\ index.html" 'defines the html file name to be generated
Set Fso = Server. CreateObject ("Scripting. FileSystemObject ")
Set FsoH = Fso. OpenTextFile (Server. Mappath (".. \ templates \ news_show.html"), 1, true) 'reads the Template
Content = FsoH. ReadAll
Set FsoRs = Conn. Execute ("select * from news where id =" & id)
Title = FsoRs ("title ")
Demo = FsoRs ("demo ")
Content = Replace (Content, "{id}", FsoRs ("id "))
Content = Replace (Content, "{title}", FsoRs ("title "))
Content = Replace (Content, "{demo}", FsoRs ("demo "))
Content = Replace (Content, "{webname}", webname)
Content = Replace (Content, "{icp}", icp)
Content = Replace (Content, "{dianhua}", dianhua)
Content = Replace (Content, "{dizhi}", dizhi)
Content = Replace (Content, "{qq}", qq)
Content = Replace (Content, "{alibaba}", alibaba)
Content = Replace (Content, "{tongji}", tongji)
FsoRs. Close
Set FsoRs = Nothing
Set stm = server. createobject ("ADODB. Stream ")
Stm. Charset = "gb2312" 'defines the Encoding
Stm. Open
Stm. WriteText content
Stm. SaveToFile FilePath, 2
Set stm = nothing
End Function
%>
<%
Function FSOCreateDIR (LocalPath)
Dim patharr, path_level, I, pathtmp, cpath, CreateDIR, FileObject
On error resume next
LocalPath = Server. MapPath (LocalPath)
LocalPath = replace (LocalPath ,"\","/")
Set FileObject = server. createobject ("Scripting. FileSystemObject ")
Patharr = split (LocalPath ,"/")
Path_level = ubound (patharr)
For I = 0 to path_level
If I = 0 then pathtmp = patharr (0) & "/" else pathtmp = pathtmp & patharr (I )&"/"
Cpath = left (pathtmp, len (pathtmp)-1)
If not FileObject. FolderExists (cpath) then FileObject. CreateFolder (cpath)
Next
Set FileObject = nothing
If err. number <> 0 then
CreateDIR = false
Err. Clear
Else
CreateDIR = true
End if
End function
%>
3. Add and generate static news links in the background Copy codeThe Code is as follows: <TD height = 20 align = "center"> <a href = ".../admin_product/saveaddnews. asp? Action = htmlall "target =" ggdlab "> generate static news </a> </TD>
From my blog
Http://blog.csdn.net/lingfeng179