<%=title%>
<%
if id<=0 then
call ShowAll
else
call ShowOne(id,ShowOne_num)
end if
Sub ShowAll
dim rs_dir,rs
set rs_dir=conn.execute("select dir_id,dir_name,path_name from product_dir order by dir_order")
path_name=rs_dir("path_name")
dir_name=rs_dir("dir_name")
while not rs_dir.eof
Response.Write("
"&vbcrlf)
Response.Write("
"&vbcrlf)
set rs=conn.execute("select top "&ShowAll_num&" * from product where dir_id="&rs_dir("dir_id")&" order by post_date desc")
while not rs.eof
product_intro=GetIntro(rs("post_text"))
%>
-
<%
rs.movenext
wend
set rs=nothing
Response.Write("
"&vbcrlf)
rs_dir.movenext
wend
set rs_dir=nothing
End Sub
Sub ShowOne(the_dir_id,the_num)
dim where_dir,rs,rs_dir
where_dir="dir_id="&the_dir_id
num=conn.execute("select count(post_id) from product where "&where_dir)(0)
if num>0 then
'begin
set rs_dir=conn.execute("select dir_name,path_name from product_dir where dir_id="&the_dir_id)
if not rs_dir.eof then
path_name=rs_dir("path_name")
dir_name=rs_dir("dir_name")
end if
set rs_dir=nothing
Response.Write("
"&vbcrlf)
Response.Write("
"&vbcrlf)
set rs=conn.execute("select * from product where "&where_dir&" order by post_order")
while not rs.eof
product_intro=GetIntro(rs("post_text"))
%>
-
<%
rs.movenext
wend
set rs=nothing
Response.Write("
"&vbcrlf)
'end
end if
End Sub
Function GetIntro(the_text)
dim regEx,temp_text
temp_text=the_text
Set regEx=New RegExp
regEx.Global=True
regEx.IgnoreCase=True
regEx.Pattern="<[a-z/][^'"">]*(('[^']*'|""[^""]*"")[^'"">]*)*>"
temp_text=regEx.Replace(temp_text,"")
temp_text=left(temp_text,intro_len)
regEx.Pattern="\s+\S*$"
temp_text=regEx.Replace(temp_text,"")
GetIntro=trim(temp_text)&" ..."
End Function
%>