庄严肃穆的情景描写:关于动力文章后台管理搜索的问题

来源:百度文库 编辑:高考问答 时间:2024/04/30 00:00:46
使用过动力文章的朋友应该都遇过这样的问题,如果是按Content或其它几项搜索,则第一面显示很正常,点下一页的时候就变成以Title搜索了,不知道是什么原因,请高手赐教

。搜索的源码简单点如下:
=============================================================================================================================================
if ManageType="MyArticle" then
sql=sql & " and A.Editor='" & AdminName & "' "
else
if keyword<>"" then
select case strField
case "Title"
sql=sql & " and A.Title like '%" & keyword & "%' "
case "Content"
sql=sql & " and A.Content like '%" & keyword & "%' "
case "Author"
sql=sql & " and A.Author like '%" & keyword & "%' "
case "Editor"
sql=sql & " and A.Editor like '%" & keyword & "%' "
case else
sql=sql & " and A.Title like '%" & keyword & "%' "
end select
end if
end if
=============================================================================================================================================
显示“上一页 下一页”等信息
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
dim n, i,strTemp,strUrl
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
strTemp= "<table align='center'><tr><td>"
if ShowTotal=true then
strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & "  "
end if
strUrl=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首页 上一页 "
else
strTemp=strTemp & "<a href='" & strUrl & "page=1'>首页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "'>上一页</a> "
end if

if n-currentpage<1 then
strTemp=strTemp & "下一页 尾页"
else
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "'>下一页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & n & "'>尾页</a>"
end if
strTemp=strTemp & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & strUnit & "/页"
if ShowAllPages=True then
strTemp=strTemp & " 转到:<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "page=" & "'+this.options[this.selectedIndex].value;"">"
for i = 1 to n
strTemp=strTemp & "<option value='" & i & "'"
if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
strTemp=strTemp & ">第" & i & "页</option>"
next
strTemp=strTemp & "</select>"
end if
strTemp=strTemp & "</td></tr></table>"
response.write strTemp
end sub
照您的修改还是不行,换页的时候已经把搜索类型的参数递送到下一页了,要不我把程序发给您看看吧。

换页没有把搜索类型的参数也递送到下一页,所以strField为空,搜索类型自动转换为else里的title!

strField=Request.querystring("strField") 这句看情况而定,如果strField是用Request.Form来获取数据的话就把Request.Form改为Request

if ManageType="MyArticle" then
sql=sql & " and A.Editor='" & AdminName & "' "
else
if keyword<>"" then
select case strField
case "Title"
sql=sql & " and A.Title like '%" & keyword & "%' "
case "Content"
sql=sql & " and A.Content like '%" & keyword & "%' "
case "Author"
sql=sql & " and A.Author like '%" & keyword & "%' "
case "Editor"
sql=sql & " and A.Editor like '%" & keyword & "%' "
case else
sql=sql & " and A.Title like '%" & keyword & "%' "
end select
end if
end if
=============================================================================================================================================
显示“上一页 下一页”等信息
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
dim n, i,strTemp,strUrl
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
strTemp= "<table align='center'><tr><td>"
if ShowTotal=true then
strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & " "
end if
strUrl=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首页 上一页 "
else
strTemp=strTemp & "<a href='" & strUrl & "page=1&strField="&strField&"'>首页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "&strField="&strField&"'>上一页</a> "
end if

if n-currentpage<1 then
strTemp=strTemp & "下一页 尾页"
else
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "&strField="&strField&"'>下一页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & n & "&strField="&strField&"'>尾页</a>"
end if
strTemp=strTemp & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & strUnit & "/页"
if ShowAllPages=True then
strTemp=strTemp & " 转到:<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "page=" & "'+this.options[this.selectedIndex].value;+'&strField="&strField&""">"
for i = 1 to n
strTemp=strTemp & "<option value='" & i & "'"
if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
strTemp=strTemp & ">第" & i & "页</option>"
next
strTemp=strTemp & "</select>"
end if
strTemp=strTemp & "</td></tr></table>"
response.write strTemp
end sub