<%
dim width,height,class_cell,class_title,class_time
Sub NewsList(cid)
dim ors,irs,RecCount,i,istrue,sqlstr,bgrs,mxrs,MaxRow
'if not isobject(conn) then connectiondatabase
if mfb="" or instr(mfb,"www.huayuweb.cn")=0  then oa.msgshow("你使用是免费版，不能删除技术支持！")

set rs=oa.execute("select top 1 classid,class_show,child,parentpath,class_row,parentid,width,height ,class_cell,class_title,class_time,rootid from classlist where classid ="&cid&" order by orderid")
if not rs.eof then
   if rs(2)>0 then  'rs（2）是判断存在子栏目
     sqlstr=" and classid in (select  classid from classlist where parentpath like '"&rs(3)&","&Cid&"%' and rootid="&rs("rootid")&" order by rootid,orderid)"  '当存在子栏目的时候就要用子查询
	 
	 else
	 sqlstr=" and classid="&Cid
	 
   end if
if mfb="" or instr(mfb,"www.huayuweb.cn")=0  then oa.msgshow("你使用是免费版，不能删除技术支持！")
istrue=rs(1)
MaxRow=10
if isnull(MaxRow) or not isnumeric(MaxRow) then MaxRow=20
width=rs(6)
if isnull(width) or not isnumeric(width) then width=130
height=rs(7)
if isnull(height) or not isnumeric(height) then height=130
class_cell=rs(8)
if isnull(class_cell) or not isnumeric(class_cell) then class_cell=4
class_title=rs(9)
if isnull(class_title) or not isnumeric(class_title) then class_title=0
class_time=rs(10)
if isnull(class_time) or not isnumeric(class_time) then class_time=0

if istrue="" then
istrue=oa.execute("select class_show from classlist where classid="&rs(5))(0)
end if
if istrue="" then
istrue="列表形式"
end if

end if
rs.close

set ors=new cls_showopage
with ors
     if istrue="文章形式" then	
	 MaxRow=1  
	 end if
	 if istrue="图文列表" then
MaxRow=6	
 end if
	.pagesize=MaxRow	
	.sql="id,classid,title,text1,text2,text3,text4,zy,content,defaultpicurl,Updatetime,link,wappicUrl$ from c_article where 1=1 "&sqlstr&"$orderid,Updatetime desc,tj,id desc$ID"	 
end with
reccount=ors.reccount
iRs=ors.ResultSet()	
           if reccount<1 then
%><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
		<td align="center" style="padding-top:6px">该栏目暂无信息</td>	
		</tr>
</table>
<%
 Else
   select case istrue
          case "文章形式"
		  call Pager(iRS)
		  case "列表形式"
		  call ShowList(iRS)
		  case "图片形式"
		  call ImgList(iRS)
		  case "图文列表"
		  Call ImgPagerList11(iRS)
		  case else
		  call ShowList(iRS)
    End select
	if reccount>maxrow then
    call ors.ShowPage("a2",1)
   end if
   
End If

End Sub

Sub Pager(iRS)
dim i
For i=0 To Ubound(iRs,2)
%>
<div class="danye"><%=FixImg(iRS(8,i))%></div>	
<%
Next
End Sub

Sub ShowList(iRS)
dim i
%><div id="contain-2">
<UL >
		  <%
For i=0 To Ubound(iRs,2)
%>

<li> <% if class_time=0 then%>
		 <span class="date"> [<%=year(iRS(10,i))%>-<%if month(iRS(10,i))<10 then%>0<%=month(iRS(10,i))%><%else%><%=month(iRS(10,i))%><%end if%>-<%if day(iRS(10,i))<10 then%>0<%=day(iRS(10,i))%><%else%><%=day(iRS(10,i))%><%end if%>]</span>
		    <%end if%> <a href="<%  if isnull(irs(11,i)) or irs(11,i)="" then
response.Write(""&webdir&"show/?"&cid&"-"&irs(1,i)&"-"&iRS(0,i))&".html"
else
response.Write(irs(11,i))
end if%>" ><%=iRS(2,i)%></a>
</li>

<%Next%>
</ul></div>

  <%
End Sub

Sub ImgList(iRS)
dim i
response.Write("<div id=pro><ul>")
For i=0 To Ubound(iRs,2)
%>
<li><a href="<%  if isnull(irs(11,i)) or irs(11,i)="" then

response.Write(""&webdir&"show/?"&cid&"-"&irs(1,i)&"-"&iRS(0,i)&".html")


else
response.Write(irs(11,i))
end if%>">
                    <%if irs(9,i)<>"" then%><img src="<%if irs(12,i)<>"" then%><%=webdir&irs(12,i)%><%else%><%=webdir&irs(9,i)%><%end if%>" border="0"  alt="<%=irs(2,i)%>"   ><%else%><img src="../wapimg/npic.jpg" width="150" height="100" />
                    <%end if%></a>
				  <% if class_title=0 then%>
                 <p><a href="<%  if isnull(irs(11,i)) or irs(11,i)="" then
response.Write(""&webdir&"show/?"&cid&"-"&irs(1,i)&"-"&iRS(0,i)&".html")

else
response.Write(irs(11,i))
end if%>" ><%=irs(2,i)%></a></p>
				  <% end if%>
       </li>
<% 
 next
response.Write("</ul></div>")
End Sub

Sub ImgPagerList(iRS)
dim i
For i=0 To Ubound(iRs,2)
%>

<%
Next
End Sub
%><%


Sub ImgPagerList11(iRS)
dim i
response.Write("<div id=twlb><ul>")
%>
<%
For i=0 To Ubound(iRs,2)
%>
 
<li><%if irs(9,i)<>"" then%> <a href="<%  if isnull(irs(11,i)) or irs(11,i)="" then
response.Write(""&webdir&"show/?"&cid&"-"&irs(1,i)&"-"&iRS(0,i))&".html"
else
response.Write(irs(11,i))
end if%>" ><div class="tp"><img src="<%=webdir&irs(9,i)%>"  border="0"  alt="<%=irs(2,i)%>"  class="img1"><%end if%></div><p class="bt"><%=iRS(2,i)%></p><p class="js"><%=left(RemoveHTML(iRS(8,i)),40)%>......</p><p class="more">【详细内容】</p>
</a></li>

<%Next%><!--1=编号(ClassID) 2=名称(Title) 3=text1 4=text2  5=text3 6=text4 7=zy 8=说明(Content) 9=图片(DefaultPicUrl)-->
<%
response.Write("</ul></div>")
End Sub
%>
<%Function RemoveHTML(strHTML)
StrHtml = Replace(StrHtml,vbCrLf,"") 
StrHtml = Replace(StrHtml,Chr(13)&Chr(10),"") 
StrHtml = Replace(StrHtml,Chr(13),"") 
StrHtml = Replace(StrHtml,Chr(10),"") 
StrHtml = Replace(StrHtml," ","") 
StrHtml = Replace(StrHtml,"    ","")
StrHtml = Replace(StrHtml,"&nbsp;","")
Dim objRegExp, Match, Matches 
Set objRegExp = New Regexp 

objRegExp.IgnoreCase = True 
objRegExp.Global = True


objRegExp.Pattern = "<style(.+?)/style>" 

Set Matches = objRegExp.Execute(strHTML) 

For Each Match in Matches 
strHtml=Replace(strHTML,Match.Value,"") 
Next


objRegExp.Pattern = "<script(.+?)/script>" 

Set Matches = objRegExp.Execute(strHTML) 
For Each Match in Matches 
strHtml=Replace(strHTML,Match.Value,"") 
Next

objRegExp.Pattern = "<.+?>" 
Set Matches = objRegExp.Execute(strHTML) 
For Each Match in Matches 
strHtml=Replace(strHTML,Match.Value,"") 
Next

RemoveHTML=strHTML 
Set objRegExp = Nothing 
End Function%><%Function FixImg(sString) 

    Dim sReallyDo, regEx, iReallyDo 
    Dim oMatches, cMatch 
    Dim tStartTime, tEndTime 
    If IsNull(sString) Then 
        FixImg = "" 
        Exit Function 
    End If 
    sReallyDo = sString 
    On Error Resume Next 
    sReallyDo = Replace(sReallyDo, vbCr, " ") 
    sReallyDo = Replace(sReallyDo, vbLf, " ") 
    sReallyDo = Replace(sReallyDo, vbTab, " ") 
    sReallyDo = Replace(sReallyDo, "<img ", vbCrLf & "<img ", 1, -1, 1) 
    sReallyDo = Replace(sReallyDo, "/>", " />", 1, -1, 1) 
    sReallyDo = ReplaceAll(sReallyDo, "= ", "=", True) 
    sReallyDo = ReplaceAll(sReallyDo, "> ", ">", True) 
    sReallyDo = Replace(sReallyDo, "><", ">" & vbCrLf & "<") 
    sReallyDo = Trim(sReallyDo) 
    On Error GoTo 0 
    Set regEx = New RegExp 
    regEx.IgnoreCase = True 
    regEx.Global = True 
    regEx.Pattern = "<img.*?\ssrc=([^\""\’\s][^\""\’\s>]*).*?>" 
    sReallyDo = regEx.Replace(sReallyDo, "<img src=""$1"" />") 
    regEx.Pattern = "<img.*?\ssrc=([\""\’])([^\""\’]+?)\1.*?>" 
    sReallyDo = regEx.Replace(sReallyDo, "<img src=""$2"" />") 
    FixImg = sReallyDo 
End Function %>