K9 通用版 博客版 主题版 地方门户版 企业版 |   企业(ASP) 分类 使用 分享 疑问 模板 建议 帮助 错误 其他
+新建主题 [Ajax]
填写帐号密码即可完成注册
+新建话题 最新回复排序 最新主题排序 精华帖子

KingCMS后台评论模块直接点击进入被评文章的方法

1Next >

ahao303 发表于:10-10-04 19:28 [添加收藏] 楼主 [回复] #Top#
ahao303 人气:152 积分:1877 金币:10882
KC元老

点修改方法从freehzw的网站中扒来的,个人认为比较实用,所以发布出来大家共享

先打开:admin/comment/index.asp文件,找到如下代码(第121—177行):

sub king_list()
king.head king.path,kc.lang("title")
dim rs,data,i,dp'lpath:linkpath
dim but,sql,p,v,insql,kid,ip,uname
p=quest("p",0)
v=quest("v",2)
kid=quest("kid",2)
ip=quest("ip",0)
if king.instre(kc.plugin,p)=false then king.error king.lang("error/invalid")
select case cstr(v)
case"0",""
  if king_dbtype=0 then'ACCESS
   insql="now()-kdate<1"
  else
   insql="getdate()-kdate<1"
  end if
case"1"
  if king_dbtype=0 then'ACCESS
   insql="now()-kdate<3"
  else
   insql="getdate()-kdate<3"
  end if
case"2"
  insql="kisview=0"
case"3"
  insql="kisview=1"
end select
if validate(ip,12) then insql="kuserip='"&safe(ip)&"'"
if len(kid)>0 then insql="kid="&kid
sql="select cmid,kcontent,kusername,kuserip,kgood,kbad,kdate,kid from king__"&safe(p)&"_comment where "&insql&" order by cmid desc;"
kc.list
set dp=new record
  dp.purl="index.asp?pid=$&rn="&dp.rn&"&action=list&p="&p&"&v="&v&"&kid="&kid&"&ip="&ip
  dp.value="p="&p
  dp.create sql
  dp.but=dp.sect("create:"&encode(king.lang("common/create"))&"|-|view1:"&encode(kc.lang("common/v1"))&"|view0:"&encode(kc.lang("common/v0")))&dp.prn & dp.plist
  dp.js="cklist(K[0])+'[<a href=""index.asp?action=list&p="&p&"&v="&v&"&kid='+K[7]+'"">"&p&"ID:'+K[7]+'</a>] <strong>'+K[2]+'</strong> <a href=""index.asp?action=list&p="&p&"&ip='+K[3]+'"">'+K[3]+'</a><a href=""http://www.kingcms.cn/ip.asp?ip='+K[3]+'"" target=""_blank"">["&kc.lang("common/soip")&"]</a> "&kc.lang("common/good")&"('+K[4]+') "&kc.lang("common/bad")&"('+K[5]+') @ '+K[6]+'<blockquote>'+K[1]+'</blockquote>'"
  Il dp.open
  Il "<tr><th>"&kc.lang("list/name")&"</th></tr>"
  Il "<script>"
  for i=0 to dp.length
   if len(dp.data(2,i))>0 then uname=dp.data(2,i) else uname=kc.lang("common/guest")
   Il "ll("&dp.data(0,i)&",'"&htm2js(king.ubbencode(dp.data(1,i)))&"','"&htm2js(uname)&"','"&htm2js(dp.data(3,i))&"',"&dp.data(4,i)&","&dp.data(5,i)&",'"&htm2js(dp.data(6,i))&"',"&dp.data(7,i)&");"
  next
  Il "</script>"
  Il dp.close
set dp=nothing
end sub

修改为:

sub king_list()
king.head king.path,kc.lang("title")
dim rs,data,i,dp'lpath:linkpath
dim but,sql,p,v,insql,kid,ip,uname,rs_artpath,rs_listpath
p=quest("p",0)
v=quest("v",2)
kid=quest("kid",2)
ip=quest("ip",0)
if king.instre(kc.plugin,p)=false then king.error king.lang("error/invalid")
select case cstr(v)
case"0",""
  if king_dbtype=0 then'ACCESS
   insql="now()-kdate<1"
  else
   insql="getdate()-kdate<1"
  end if
case"1"
  if king_dbtype=0 then'ACCESS
   insql="now()-kdate<3"
  else
   insql="getdate()-kdate<3"
  end if
case"2"
  insql="kisview=0"
case"3"
  insql="kisview=1"
end select
if validate(ip,12) then insql="kuserip='"&safe(ip)&"'"
if len(kid)>0 then insql="kid="&kid
sql="select cmid,kcontent,kusername,kuserip,kgood,kbad,kdate,kid from king__"&safe(p)&"_comment where "&insql&" order by cmid desc;"

kc.list
set dp=new record
  dp.purl="index.asp?pid=$&rn="&dp.rn&"&action=list&p="&p&"&v="&v&"&kid="&kid&"&ip="&ip
  dp.value="p="&p
  dp.create sql
  dp.but=dp.sect("create:"&encode(king.lang("common/create"))&"|-|view1:"&encode(kc.lang("common/v1"))&"|view0:"&encode(kc.lang("common/v0")))&dp.prn & dp.plist
 
  'add by freehzw
  Set rs_artpath=Server.createobject ("Adodb.recordset")
  Set rs_listpath=Server.createobject ("Adodb.recordset")
   If kid<>"" And v<>"" then
    set rs_artpath=conn.execute("select artpath,listid from kingart where artid="&CInt(kid)&";")
    set rs_listpath=conn.execute("select listpath from kingart_list where listid="&rs_artpath(1)&";")
    dp.js="cklist(K[0])+'[<a target=""_blank"" href=""/"&rs_listpath(0)&"/"&rs_artpath(0)&""" >查看文章</a>] <strong>'+K[2]+'</strong> <a href=""index.asp?action=list&p="&p&"&ip='+K[3]+'"">'+K[3]+'</a><a href=""http://www.kingcms.cn/ip.asp?ip='+K[3]+'"" target=""_blank"">["&kc.lang("common/soip")&"]</a> "&kc.lang("common/good")&"('+K[4]+') "&kc.lang("common/bad")&"('+K[5]+') @ '+K[6]+'<blockquote>'+K[1]+'</blockquote>'"
    rs_artpath.close
    rs_listpath.close
    Set rs_listpath=Nothing
    Set rs_artpath=Nothing
   
   Else
    dp.js="cklist(K[0])+'[<a href=""index.asp?action=list&p="&p&"&v="&v&"&kid='+K[7]+'"">"&p&"ID:'+K[7]+'</a>] <strong>'+K[2]+'</strong> <a href=""index.asp?action=list&p="&p&"&ip='+K[3]+'"">'+K[3]+'</a><a href=""http://www.kingcms.cn/ip.asp?ip='+K[3]+'"" target=""_blank"">["&kc.lang("common/soip")&"]</a> "&kc.lang("common/good")&"('+K[4]+') "&kc.lang("common/bad")&"('+K[5]+') @ '+K[6]+'<blockquote>'+K[1]+'</blockquote>'"
   End If
  Il dp.open
  Il "<tr><th>"&kc.lang("list/name")&"</th></tr>"
  Il "<script>"
  for i=0 to dp.length
   if len(dp.data(2,i))>0 then uname=dp.data(2,i) else uname=kc.lang("common/guest")
   Il "ll("&dp.data(0,i)&",'"&htm2js(king.ubbencode(dp.data(1,i)))&"','"&htm2js(uname)&"','"&htm2js(dp.data(3,i))&"',"&dp.data(4,i)&","&dp.data(5,i)&",'"&htm2js(dp.data(6,i))&"',"&dp.data(7,i)&");"
  next
  Il "</script>"
  Il dp.close
set dp=nothing
end sub

743df 发表于:10-10-09 17:08 沙发 [回复] #Top#
743df 人气:16 积分:93 金币:580
我发的贴子终于有人复制过来了,不错,看来还是有人需要的

1Next >

发表回复

帐号 匿名发布 审核后可见 [加载完整在线编辑器]
内容
验证码
KingCMS 内容管理系统

关于我们 联系我们 广告报价 付款方式 站点导航

Copyright © 2004-2015 Focuznet All rights reserved.

广州唯众网络科技有限公司 粤ICP备08008106号