search_cp.asp

来自「一个完全仿照阿里巴巴的网站管理系统 本软件没有版权问题」· ASP 代码 · 共 117 行

ASP
117
字号
<!--#include file="main.asp"-->
<%word=request("word")
key=request("key")
ypxxone_id=request("ypxxone_id")
ypxxtwo_id=request("ypxxtwo_id")
addone_id=request("addone_id")
addtwo_id=request("addtwo_id")
if ypxxone_id<>"" then
xxsort=" and SMT_ypxxone_id="&ypxxone_id&""
if ypxxtwo_id<>"" then
xxsort=xxsort&" and SMT_ypxxtwo_id="&ypxxtwo_id&""
end if
end if
'==================================
if word="" or key="" then
response.redirect"search.asp"
end if%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>产品搜索 - <%=citytitle%></title>
</head>

<%search%>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td valign=top>
<!--结果-->
<table width="600" border="0" cellspacing="0" cellpadding="10">
<%sql="select * from SMT_cp where SMT_key=1 and SMT_key1=1 and SMT_key2=1 and (SMT_cpname like'%"&word&"%' or SMT_cpsm like'%"&word&"%') "&xxsort&" order by SMT_id desc"
set rs=server.createobject("adodb.recordset")                     
rs.open sql,conn,1,1                     
if rs.eof and rs.bof then                     
	response.write "<tr><td height=50>没有找到能和“<font color=red>"&word&"</font>”匹配的内容,请尝试其它搜索。</td></tr>"
else  
'分页的实现 
listnum=10
Rs.pagesize=listnum
page=Request("page")
if (page-Rs.pagecount) > 0 then
page=Rs.pagecount
elseif page = "" or page < 1 then
page = 1
end if
Rs.absolutepage=page
'编号的实现
j=rs.recordcount
j=j-(page-1)*listnum%>
<%i=0
nn=request("page")
if nn="" then
n=0
else
nn=nn-1
n=listnum*nn
end if
do while not rs.eof and i<listnum
'====================
SMT_cpname=replace(rs("SMT_cpname"),word,"<font color=red>"&word&"</font>")
aaa=trim(rs("SMT_cpjm"))
if instr(aaa,word) then
a=len(aaa)
b=instr(aaa,word)
if b<50 then c=left(aaa,b) else c="..."&mid(aaa,b-50,50)
if a-(b+len(word))<50 then d=right(aaa,a-(b+len(word))) else d=mid(aaa,b,50)&"..."
SMT_cpjm=c&d
else
SMT_cpjm=Trim(left(aaa,100))&"..."
end if
SMT_cpjm=replace(SMT_cpjm,word,"<font color=red>"&word&"</font>")

n=n+1
%>
<tr>
 <td height=30 width=80 valign=top><a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank"><img src="<%=rs("SMT_pic")%>" width="80" style="border:1px #999999 solid"></a></td>
 <td width=*><p style="line-height:200%"><a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank" class=blue><font face="宋体" size=2px><strong><%=SMT_cpname%></strong></font></a> <font color=#999999>(<%=rs("SMT_date")%>)</font>
<br>  <font face="宋体" size=2px><%=SMT_cpjm%></font></td>
</tr>
<%rs.movenext 
i=i+1 
j=j-1
loop%>
<tr>
<%filename="search_"&key&".asp?word="&word&"&key="&key&"&ypxxone_id="&ypxxone_id&"&ypxxtwo_id="&ypxxtwo_id&"&addone_id="&addone_id&"&addtwo_id="&addtwo_id&""%>
<td align=right colspan=2><font class=f14><%=page%>/<%=Rs.pagecount%> 页 
<% if page=1 then %><%else%>
<a href=<%=filename%> class=blue>|<<</a> 
<a href=<%=filename%>&page=<%=page-1%> class=blue><<</a> 
<a href=<%=filename%>&page=<%=page-1%> class=blue>[<%=page-1%>]</a> 
<%end if%><% if Rs.pagecount=1 then %><%else%>[<%=page%>]<%end if%>
<% if Rs.pagecount-page <> 0 then %>
<a href=<%=filename%>&page=<%=page+1%> class=blue>[<%=page+1%>]</a> 
<a href=<%=filename%>&page=<%=page+1%> class=blue>>></a> 
<a href=<%=filename%>&page=<%=Rs.pagecount%> class=blue>>>|</a> 
<%end if%>&nbsp;&nbsp;</font></td>
<%end if%></tr>
</table>
<!--结果-->
	</td>
    <td valign=top>
<!--竞价-->
<%Call CpcView200%><br><br><br>
<!--竞价-->
	</td>
  </tr>
</table>
<!--====== bottom ========-->
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor=#ffffff>
<tr><td height=2 bgcolor=#4795EC></td></tr>
  <tr>
    <td align="center" height=80><%=citybottom%></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?