急~~关于用kingcms做网站的问题???

sun7bear88 2007-04-06 11:03:55
我想问一下用kingcms做过网站的朋友,用这个search.asp怎么搜不出结果来呢?
到底要怎么改才能显示出搜索结果呢????{king:search/}该怎么用呢?
...全文
299 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
bear88 2007-04-07
  • 打赏
  • 举报
回复
怎么没有人用kingcms吗?
bear88 2007-04-06
  • 打赏
  • 举报
回复
'search *** *** www.KingCMS.com *** ***
sub king_search()
kingtitle=king.lang("common/search")&" - "&query
kingguide=king.guide(0)&"<a href=""search.asp"">"&king.lang("common/search")&"</a> >> "&query

dim sql,insql,selected,formatquery
formatquery=clskeyword(query)
dim data,rs,i,j
dim space,classid
space=l1ll("space",2)
classid=l1ll("classid",2)

ol="<div id=""k_search""><form name=""form1"" method=""get"" action="""&king.page&""" >"
ol=ol&"<input id=""k_query"" type=""text"" name=""query"" value="""&query&""" maxlength=""150"" /> "

ol=ol&"<select name=""space"">"
if cstr(space)="0"then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""0"""&selected&">"&king.lang("common/title")&"</option>"
if cstr(space)="1"then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""1"""&selected&">"&king.lang("common/content")&"</option>"
if cstr(space)="2"then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""2"""&selected&">"&king.lang("common/author")&"</option>"
ol=ol&"</select> "

ol=ol&"<select name=""classid"">"
set rs=conn.execute("select distinct classid from kingmenu where not classid in (0,1,4,6) order by classid")
if not rs.eof and not rs.bof then
while (not rs.eof)
if cstr(classid)=cstr(rs(0)) then selected=" selected=""selected""" else selected=""
ol=ol&"<option value="""&rs(0)&""""&selected&">"&king.lang("sub/s"&rs(0))&"</option>"
rs.movenext
wend
else
ol=ol&"<option value=""0"">"&king.lang("system/error/notmenu")&"</option>"
end if
set rs=nothing
ol=ol&"</select> "
ol=ol&"<input type=""hidden"" name=""king"" value=""kingcms"" /> "
ol=ol&"<input type=""hidden"" name=""rn"" value="""&king.rn&""" />"
ol=ol&"<input type=""submit"" name=""submits"" value="""&king.lang("common/search")&""" /> <a href=""search.asp"">高级搜索</a>"
ol=ol&"</form>"
ol=ol&"<dl>"

dim outdt,outdd1,outdd2,menuname,menupath,querycount,datamenu,bbstype
'参数处理并显示 sql填写规则:第一个必须为menuid!!!
select case cstr(classid)
case"2"
sql=" menuid,arttitle,artdescription,artauthor,artdate,artpath,artgrade,artid "'7
if cstr(space)="0" then'只查询标题
insql=IIII1("arttitle",killjapan(formatquery),1)
elseif cstr(space)="1" then
insql=IIII1("artcontent",killjapan(formatquery),1)
else
insql=IIII1("artauthor",killjapan(formatquery),1)
end if
if len(insql)>2 then insql=" and "&insql else insql=""
sql="select top 1000 "&sql&" from kingart where artshow=1 and menuid<>0 "&insql&" order by artorder desc,artid desc;"
king.open sql,king.page&"?pid=$&rn="&king.rn&"&query="&server.urlencode(query)&"&classid="&classid&"&space="&space,1
querycount=conn.execute("select count(artid) from kingart where artshow=1 and menuid<>0 "&insql&";")(0)
case"10"
sql=" menuid,bbstitle,bbscontent,username,bbsdate,topicid,lastdate,sysdate "'7
if cstr(space)="0" then'只查询标题
insql=IIII1("bbstitle",killjapan(formatquery),1)
elseif cstr(space)="1" then
insql=IIII1("bbscontent",killjapan(formatquery),1)
else
insql=IIII1("username",killjapan(formatquery),1)
end if
if len(insql)>2 then insql=" and "&insql else insql=""
sql="select top 1000 "&sql&",menuid from kingtopic where topicdel=0 "&insql&" order by lastdate desc,topicid desc;"
king.open sql,king.page&"?pid=$&rn="&king.rn&"&query="&server.urlencode(query)&"&classid="&classid&"&space="&space,1
querycount=conn.execute("select count(topicid) from kingtopic where topicdel=0 "&insql&";")(0)
case else king.error("system/error/search/classid")
end select

'搜索数量
if king.length>=0 then
ol=ol&"<p>约有"&formatnumber(querycount,0,true)&"项符合 <strong>"&query&"</strong> 的查询结果,以下是第"&cstr((king.pid-1)*king.rn+1)&"-"&cstr(king.count-(king.pid-1)*king.rn)&"项。 (搜索用时 "&formatnumber(timer()-king.tDiff,2,true)&" 秒)</p>"
else
ol=ol&"<p>找不到和您的查询 "&query&" 相符的网页。</p>"
end if

set rs=conn.execute("select menuid,menuname,menupath,bbstype from kingmenu;")
if not rs.eof and not rs.bof then
datamenu=rs.getrows()
end if
set rs=nothing
'循环输出
for i=0 to king.length'循环一遍

for j=0 to ubound(datamenu,2)
if cstr(datamenu(0,j))=cstr(king.data(0,i)) then
menuname=datamenu(1,j)
menupath=datamenu(2,j)
bbstype=datamenu(3,j)
exit for
end if
next

select case cstr(classid)
case"2"
if ll11("0",king.data(6,i)) then'静态
if cstr(king.named)="1" then
outdt="<a target=""_blank"" href=""../"&menupath&"/"&III11(king.data(4,i))&"/"&king.data(5,i)&king.ext&""">"&king.keywordlight(htmlencode(king.data(1,i)),formatquery)&"</a>"
else
outdt="<a target=""_blank"" href=""../"&menupath&"/"&king.data(5,i)&king.ext&""">"&king.keywordlight(htmlencode(king.data(1,i)),formatquery)&"</a>"
end if
else
outdt="<a target=""_blank"" href=""article.asp?/"&king.data(7,i)&king.ext&""">"&king.keywordlight(htmlencode(king.data(1,i)),formatquery)&"</a>"
end if
outdd1=king.keywordlight(htmlencode(king.data(2,i)),formatquery)
outdd2="<i>"&king.data(4,i)&"</i> - <span>"&king.keywordlight(htmlencode(king.data(3,i)),formatquery)&"</span> - <a target=""_blank"" href=""../"&menupath&"/index"&king.ext&""">"&htmlencode(menuname)&"</a> - <a target=""_blank"" href=""link.asp?url="&server.urlencode(replace(king_link,"{king}",server.urlencode(king.data(1,i))))&""">类似网页</a>"
case"10"
'" menuid,bbstitle,bbscontent,username,bbsdate,topicid,lastdate,sysdate "'7
if ll11("0,1",bbstype) then
outdt="<a target=""_blank"" href=""../"&menupath&"/"&III11(king.data(7,i))&"/"&king.data(5,i)&king.ext&""">"&king.keywordlight(htmlencode(king.data(1,i)),formatquery)&"</a>"
else
outdt="<a target=""_blank"" href=""topic.asp?/"&king.data(5,i)&king.ext&""">"&king.keywordlight(htmlencode(king.data(1,i)),formatquery)&"</a>"
end if
outdd1=king.keywordlight(htmlencode(king.lefte(king.cls(llIIl(king.data(2,i))),180)),formatquery)
outdd2="<i>"&king.data(4,i)&"</i> - <span><a target=""_blank"" href=""user.asp?username="&server.urlencode(king.data(3,i))&""">"&king.keywordlight(htmlencode(king.data(3,i)),formatquery)&"</a></span> - <a target=""_blank"" href=""../"&menupath&"/index"&king.ext&""">"&htmlencode(menuname)&"</a> - <a target=""_blank"" href=""link.asp?url="&server.urlencode(replace(king_link,"{king}",server.urlencode(king.data(1,i))))&""">类似网页</a>"

end select
'每页显示数
ol=ol&"<dt>"&outdt&"</dt>"
ol=ol&"<dd>"&outdd1&"</dd>"
ol=ol&"<dd>"&outdd2&"</dd>"
next
if cstr(king.length)="-1" then ol=ol&"<dt>"&king.lang("system/error/search")&"</dt>"
ol=ol&"</dl>"
ol=ol&king.plist
ol=ol&"</div>"
end sub
'outhtm *** *** www.KingCMS.com *** ***
sub king_outhtm()
%>{king:search/}
<%end sub%>
bear88 2007-04-06
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="inc/conn.asp" -->
<!--#include file="inc/fun.asp" --><%
' Edit: Sin.CS
' Date:
' Memo: (去掉charset,改成utf-8?这个过程在加载过程里。而不是这里)
' Memo: (参数)

rem query :关键字
rem space :搜索范围,标题和索引(内容)
rem rn :每页显示
rem classid :搜索类别,即论坛/或文章


dim king,query'outhtm的简写,全局变量
query=trim(request("query"))
set king=new kingcms
king.head 0,0
select case IIII1("keyword",clskeyword(query),1)'query
case "","()" king_def()
case else king_search()
end select
king_outhtm
set king=nothing
'def *** *** www.KingCMS.com *** ***
sub king_def()'需要加入标题,访问级别
dim classid,rs,i,selected
dim space
space=l1ll("space",2)
classid=l1ll("classid",2)

kingtitle=king.lang("common/search")
kingguide=king.guide(0)&kingtitle
ol=ol&"<form name=""form1"" method=""get"" action="""&king.page&""" class=""k_form"">"
ol=ol&"<h6>"&kingtitle&"</h6>"
ol=ol&"<table cellspacing=""1"">"
ol=ol&"<tr><th>"&king.lang("stage/keyword")&"</th><td>"
ol=ol&"<input id=""k_query"" type=""text"" name=""query"" value="""&query&""" maxlength=""150"" />"
ol=ol&"</td></tr>"

'搜索范围
ol=ol&"<tr><th>搜索范围</th><td>"
ol=ol&"<select name=""space"">"
if cstr(space)="0" then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""0"""&selected&">"&king.lang("common/title")&"</option>"
if cstr(space)="1"then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""1"""&selected&">"&king.lang("common/content")&"</option>"
if cstr(space)="2"then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""2"""&selected&">"&king.lang("common/author")&"</option>"
ol=ol&"</select>"
ol=ol&"</td></tr>"

'每页显示
ol=ol&"<tr><th>每页显示</th><td>"
ol=ol&"<select name=""rn"">"
if cstr(king.rn)="10" then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""10"""&selected&">10</option>"
if cstr(king.rn)="20" then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""20"""&selected&">20</option>"
if cstr(king.rn)="50" then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""50"""&selected&">50</option>"
if cstr(king.rn)="100" then selected=" selected=""selected""" else selected=""
ol=ol&"<option value=""100"""&selected&">100</option>"
ol=ol&"</select>"
ol=ol&"</td></tr>"

'栏目
ol=ol&"<tr><th>搜索对象</th><td>"
ol=ol&"<select name=""classid"">"
set rs=conn.execute("select distinct classid from kingmenu where not classid in (0,1,4,6) order by classid")
if not rs.eof and not rs.bof then
while (not rs.eof)
if cstr(classid)=cstr(rs(0)) then selected=" selected=""selected""" else selected=""
ol=ol&"<option value="""&rs(0)&""""&selected&">"&king.lang("sub/s"&rs(0))&"</option>"
rs.movenext
wend
else
ol=ol&"<option value=""0"">"&king.lang("system/error/notmenu")&"</option>"
end if
set rs=nothing
ol=ol&"</select>"
ol=ol&"</td></tr>"

ol=ol&"</table>"

ol=ol&"<div id=""k_active"">"
ol=ol&"<input type=""hidden"" name=""king"" value=""kingcms"" />"
ol=ol&"<input class=""submit"" type=""submit"" name=""submits"" value="""&king.lang("common/search")&""" /> "
ol=ol&"<input type=""button"" name=""submits"" value="""&king.lang("common/back")&""" onClick=""javascript:history.back();"" />"
ol=ol&"</div></form>"
end sub
KingCMS PHP企业版是一套简单易学,代码精巧的开源内容管理系统(CMS),支持PHP SQLite3/MySQL和ASP ACCESS/MSSQL,模板标签机制容易理解,制作方便,完全自定义的URL 等功能助你轻易实现众多SEO细节,是制作网络营销型企业网站的首选,此版本为KingCMS正式版的SP2版。 KingCMS PHP企业版 6.1.1641 SP2 更新:2010-10-11 修复,前台comment.php的评论分页无效 修复,后台爬虫管理的统计无效 修复,文章录入关键字的分隔规则为英文状态逗号而不是空格 修复,产品模型下的状态属性管理操作无效 增加,登陆后台管理登陆界面的验证码项 修正,对评论和留言的内容进行过滤 增加,碎片增加删除功能 完善,留言功能增加回复管理 升级xheditor到1.1.10新版 增加,站点地图标签 增加,预定义用户头像,把头像图片放到/images/headface下即可读取 增加,根据文章ID或Tag调用相关记录的标签,更强大的SEO功能 增加,对基本模型的标题后台搜索功能 完善,对留言和评论采用地方门户版的审核机制,已注册的用户只要有一条申核通过,自动申核通过。非注册的用户则自动留给管理员申核 增加,提供Sp2的新demo示例模板 KingCMS PHP企业版升级办法: 备份原有数据库文件,Mysql的建议使用phpmyadmin备份,SQLite的直接拷贝根目录数据库文件备份; 除了\images、\template和\upfiles文件夹,config.php和数据库(SQLite的数据库)文件,其他文件都移到其他目录比如新建old目录备份; 把新的文件(除\images和\template文件夹,config.php和INSTALL.php文件外)上传到根目录; 访问后台登陆,重新更新缓存和生成站点,完成升级。 KingCMS PHP企业版全新安装: 将下载的安装包解压后上传到网站根目录; 参考template目录下的默认模板制作网站模板; 上传模板到网站的template目录,或新建一个目录进行存放; 访问http://域名地址/INSTALL.php,按照提示进行安装;(Linux环境请注意大小写)访问后台登陆,安装所需要的模块,并录入资料; 生成全站,完成安装。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧