<%
if not isempty(request("page")) then
CurrentPage=cint(request("page"))
else
CurrentPage=1
end if
sql="select id,标题,大类,日期 from 内容 where 标题 like '%"& key &"%' and 模板=2 order by 序号 desc,id desc"
set rs = server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if rs.recordcount=0 then
response.write "
暂无此搜索结果..."
else
MaxperPage=9
TotalPut=rs.recordcount
if CurrentPage <1 then
CurrentPage=1
end if
if (CurrentPage-1)*MaxperPage>TotalPut then
if (TotalPut mod MaxperPage)=0 then
CurrentPage=TotalPut\MaxperPage
else
CurrentPage=TotalPut\MaxperPage+1
end if
end if
if CurrentPage=1 then
showcontent
showpages totalput,MaxPerPage,"search.asp"
else
if (CurrentPage-1)*MaxperPage
<% do while not rs.eof and i< MaxperPage
surl=trim(rs("标题"))
surl=c(surl)
surl=replace(surl," ","-")
surl=replace(surl," ","-")
surl=replace(surl," & ","-")
surl=replace(surl,"&","-")
surl=replace(surl,"?","-")
surl=replace(surl,"/","-")
surl=replace(surl,",","-")
surl=replace(surl,",","-")
surl=replace(surl,"、","-")
set rs2=server.CreateObject("adodb.recordset")
rs2.open "select * from wjj where cpid="&rs("大类"),conn,1,1
if rs2.eof and rs2.bof then
swjzz="html"
else
swjzz=trim(rs2("wjname"))
end if
rs2.close
set rs2=nothing
%>
<% i=i+1
if i>=MaxperPage then exit do
rs.movenext
loop
%>
<% end sub
function showpages(totalnumber,maxperpage,filename)
dim n
if TotalPut mod MaxperPage=0 then
n=TotalPut\MaxperPage
else
n=TotalPut\MaxperPage+1
end if
response.write "
"
end function %>