文章分类
dim rst
set rst=server.CreateObject("ADODB.RecordSet")
rst.open "select * from type",conn,1
if rst.EOF then
response.write "还没有任何文章"
else
%>
全部文章
rst.MoveNext
loop
end if
rst.close
%>
热门文章排行
if typeid="" or IsEmpty(typeid) or typeid=0 then
sql="select top 10 articleid,title from learning order by hits desc"
else
sql="select top 10 articleid,title from learning where typeid=" & typeid & " order by hits desc"
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof then
response.write "还没有文章"
else
do while not rs.eof
%>
·
rs.movenext
loop
end if
rs.close
%>
function strlen(str)
dim p_len,xx
p_len=0
strlen=0
if trim(str)"" then
p_len=len(trim(str))
for xx=1 to p_len
if asc(mid(str,xx,1)) strlen=int(strlen) + 2
else
strlen=int(strlen) + 1
end if
next
end if
end function
function strvalue(str,lennum)
dim p_num,x
dim i
if strlen(str) strvalue=str
else
p_num=0
x=0
do while not p_num > lennum-2
x=x+1
if asc(mid(str,x,1)) p_num=int(p_num) + 2
else
p_num=int(p_num) + 1
end if
strvalue=left(trim(str),x)&".."
loop
end if
end function
%>