<!-- #include virtual = "/include/myopen.asp" -->
<%
	set RS = Server.CreateObject("ADODB.RecordSet")
	set RS1 = Server.CreateObject("ADODB.RecordSet")
	tmpfile="\plate\sub_default.htm"	
	I = 1
	DIM VIEW(8,10)
	FOR M = 1 TO 8
		FOR J = 0 TO 10
		VIEW(M,J) = ""
		NEXT
	NEXT
	IF Request("Class") <> "" Then
			AA = " And Class = '" & Request("Class") & "' "
		End If
        SQL = "SELECT * FROM QIANBI WHERE STATUS = '最新商品' " & AA & " Order By Num Desc"
        RS.Open SQL,CONN,adOpenKeyset ,adLockReadOnly
			IF RS.RecordCount >0 THEN
				RS.PageSize = 4	'每页一10条
				RS.AbsolutePage = 1
				RowCount = RS.PageSize
			Do While Not RS.EOF and RowCount > 0 
        
			VIEW(I,0) = RS("LB")
			VIEW(I,1) = RS("NO1")
			VIEW(I,2) = RS("DW")
			VIEW(I,3) = RS("BJG")
			VIEW(I,5) = RS("JG")
			VIEW(I,4) = RS("BMTP")
          I = I + 1
			RS.MoveNext
			RowCount = RowCount - 1
			Loop
          END IF
          RS.Close 
          IF Request("Class") <> "" Then
			AA = " And Class = '" & Request("Class") & "' "
		End If
        SQL = "SELECT * FROM QIANBI WHERE STATUS = '特卖商品' " & AA & " Order By Num Desc"
        RS.Open SQL,CONN,adOpenKeyset ,adLockReadOnly
			IF RS.RecordCount >0 THEN
				RS.PageSize = 4	'每页一10条
				RS.AbsolutePage = 1
				RowCount = RS.PageSize
			Do While Not RS.EOF and RowCount > 0 

			VIEW(I,0) = RS("LB")
			VIEW(I,1) = RS("NO1")
			VIEW(I,2) = RS("DW")
			VIEW(I,3) = RS("BJG")
			VIEW(I,5) = RS("JG")
			VIEW(I,4) = RS("BMTP")

          I = I + 1
			RS.MoveNext
			RowCount = RowCount - 1
			Loop
          END IF
          RS.Close 
          
          DIM MYVIEW(100)
          
          SQL = "SELECT DISTINCT ZLB FROM QIANBI WHERE CLASS = '" & REQUEST("CLASS") & "'"
		RS.Open SQL,CONN,adOpenKeyset ,adLockReadOnly
			IF RS.RecordCount >0 THEN
			I = 1
			DO WHILE NOT RS.EOF 
            MYVIEW(I)="<a href=/search/sub_default.asp?Class=" & Request("Class") & "&Zlb=" & Rs(0) & ">" & RS(0) & "</a>&nbsp;"
        	RS.MoveNext 
			I = I + 1
			LOOP
			END IF
			RS.Close 
%>
<%

'读取页面的膜版		
	Const ForReading = 1, ForWriting = 2
	Dim fso, f ,fw
	Set fso = CreateObject("Scripting.FileSystemObject")
	MyPath=Request.ServerVariables ("APPL_PHYSICAL_PATH")
	Set f = fso.OpenTextFile(MyPath & tmpfile, ForReading)
	ReadAllTextFile =  f.ReadAll

		'新闻部分
		FOR K = 1 TO 8
				ReadAllTextFile= Replace(ReadAllTextFile,"%IMG" & K & "%",VIEW(K,4))
				ReadAllTextFile= Replace(ReadAllTextFile,"%25IMG" & K & "%25",VIEW(K,4))
				ReadAllTextFile= Replace(ReadAllTextFile,"%LINK" & K & "%","/sales/detail.asp?id=" & VIEW(K,1) & "")
				ReadAllTextFile= Replace(ReadAllTextFile,"%25LINK" & K & "%25","/sales/detail.asp?id=" & VIEW(K,1) & "")
				ReadAllTextFile= Replace(ReadAllTextFile,"%NAME" & K & "%",VIEW(K,0))
				ReadAllTextFile= Replace(ReadAllTextFile,"%UNIT" & K & "%",VIEW(K,2))
				ReadAllTextFile= Replace(ReadAllTextFile,"%PRICE" & K & "%",VIEW(K,3))
				ReadAllTextFile= Replace(ReadAllTextFile,"%MPRICE" & K & "%",VIEW(K,5))
				ReadAllTextFile= Replace(ReadAllTextFile,"%NO" & K & "%",VIEW(K,1))
		NEXT

		'新闻部分
		FOR K = 1 TO 100
				ReadAllTextFile= Replace(ReadAllTextFile,"%CLASS" & K & "%",MYVIEW(K))
				
		NEXT

		'写文件
	
		'Set fw = fso.OpenTextFile(MyPath & "\news\default.htm", ForWriting, True)
		'fw.Write ReadAlltextFile
		'Response.Write ReadAlltextFile
	Response.Write ReadAlltextFile
	CONN.Close 
	Response.End 
	%>