<%
   dim conn   
   dim connstr

   on error resume next
   connstr="DBQ="+server.mappath("database/w163_data.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
   set conn=server.createobject("ADODB.CONNECTION")
   if err then 
      err.clear
   else
        conn.open connstr 
        if err then 
           err.clear
        end if
   end if
%>
<!--#include file="char.asp"-->
<!--生成子类代码-->

<table width="95%" bgcolor=#999999 cellspacing="1"  cellpadding="5" align=center>
<tr bgcolor=#cccccc>
    <td colspan=2><center><b>商品html生成完毕</td> 
  </tr>
<%
Function AutoCreateFolder(strPath)  'As Boolean
        On Error Resume Next

        Dim astrPath, ulngPath, i, strTmpPath
        Dim objFSO

        If InStr(strPath, "\") <=0 Or InStr(strPath, ":") <= 0 Then
                AutoCreateFolder = False
                Exit Function
        End If
        Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
        If objFSO.FolderExists(strPath) Then
                AutoCreateFolder = True
                Exit Function
        End If
        astrPath = Split(strPath, "\")
        ulngPath = UBound(astrPath)
        strTmpPath = ""
        For i = 0 To ulngPath
                strTmpPath = strTmpPath & astrPath(i) & "\"
                If Not objFSO.FolderExists(strTmpPath) Then
                        ' 创建
                        objFSO.CreateFolder(strTmpPath)
                End If
        Next
        Set objFSO = Nothing
        If Err = 0 Then
                AutoCreateFolder = True
        Else
                AutoCreateFolder = False
        End If
End Function 
dim classid
dim ArticleID
mingchen=trim(request("mingcheng"))
ClassID=request("ClassID")
mingchen=Replace(mingchen, """", "")
 		dim mypath
MyPath =mingchen
If AutoCreateFolder(MyPath) Then
        Response.Write "创建文件夹成功"
Else
        Response.Write "创建文件夹失败"
End If 
response.write MyPath

response.write mingchen
response.write ClassID

function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
'取模版
'dim rs_8,sql_8,okfile
set rs_8 = server.CreateObject ("Adodb.recordset")
sql_8="select * from demo where ifuse=1 and demoid="&request("demoid")
rs_8.open sql_8,conn,1,1
okfile=rs_8("demohtml")
rs_8.close


dim rs100,k

set rs100=server.CreateObject("adodb.recordset")
if request("ClassID")=0 then
sql="select * from w163_Article order by UpdateTime desc"
else
end if
rs100.open "select * from w163_Article where ClassID='"&ClassID&"' order by UpdateTime desc",conn,1,3
response.write sql

j=1
do while not rs100.eof

Server.ScriptTimeOut=9999999


'取商品名
UpdateTime=rs100("UpdateTime")
Keyword=rs100("Keyword") '关键字
Title=rs100("Title") '商品名称
Content=rs100("Content") '简介
Author=rs100("Author") '作者
ArticleID=rs100("ArticleID")


'读品牌资料
okfile = replace(okfile,"$classid$",classid)
okfile = replace(okfile,"listContent",listContent)
okfile = replace(okfile,"bookname",Title)
okfile = replace(okfile,"zuoze",Author)
okfile = replace(okfile,"$key$",Keyword)
okfile = replace(okfile,"$mingchen$",mingchen)

okfile = replace(okfile,"$bookid$",ArticleID)
okfile = replace(okfile,"adddate",UpdateTime)
okfile = replace(okfile,"bookcontent", Content)

   Set fso = Server.CreateObject("Scripting.FileSystemObject")

    HtmlFileName=Server.MapPath(mingchen&"/"&"w163"&ArticleID&".asp")
    Set fout = fso.CreateTextFile(HtmlFileName)
    fout.WriteLine okfile

fout.close
strkeyword=""  'next一个产品
rs100.movenext
k=k+1
if k>=1000 then exit do 
loop
rs100.close
set rs100=nothing
response.write "ok"
%>
</table>
