kingcms5部分BUG修复和修改技巧
作者:佳明妈 来源:未知 2009-10-17 人气:
1、实现文章模块的一键生成;同时其他自定义模块也可以这样实现
从后台目录admin/Article/index.asp的第555行开始,代码如下
case"createpage"
if len(list)>0 then
'重新获取listid,将子栏目包括进去,by何苦,在根列表点击下拉-生成列表及文章,可以实现包含子分类在内的模块文章一键生成.
set rs=conn.execute("select listid from kingart_list where listid in (" & list & ") or listid1 in (" & list & ");")
list = ""
if not rs.eof and not rs.bof then
data = rs.getrows()
for i=0 to ubound(data,2)
if len(list)>0 then
list = list & "," & data(0, i)
else
list = data(0,i)
end if
next
end if
rs.close
set rs = nothing
'------以上是加的,文章模块可以实现一键生成的代码
set rs=conn.execute("select artid from kingart where listid in ("&list&");")
if not rs.eof and not rs.bof then
把注释中间的代码是添加进去即可。
结果:在文章管理的根目录下,全选,点击下拉菜单中的 生成列表及文章,即可实现文章模块所有文件的一键生成.
2、kingCMS文章模块,分页功能默认打勾方法 根据实际情况修改(查询 '默认分页 )修改,已做注释
-----------------------------------------------------
打开adminArticle下的 index.asp文件
修改两个地方:
第一个:修改分页字数,默认是2000,查找代码654行:pagelistnumber=2000
修改成你想要的参数: pagelistnumber=300
第二个:修改自动分行默认打勾选:在代码796行
if cstr(form("pagelist"))="1" then checked=" checked=""checked""" else checked=""
修改成:
if cstr(form("pagelist"))="1" or cstr(form("pagelist"))="" then checked=" checked=""checked""" else checked=""
3、单页面的调用 注:where onepath like '%page%' 是判断onepath中是否包含page,
这是建立单页路径的时候指定的路径名的一部分
---------------------------------------------------
{king:sql cmd="select top 10 * from kingonepage where onepath like '%page%' order by oneid desc;"}
<a href="../../(king:onepath/)">(king:onetitle/)</a>
{/king}
4、一级栏目列表调用下级文章修改法
原文:http://www.cgboke.com/kingcms/2008_10_23_101440259.htm
因数据库结构问题,只修改到支持两级。
一、打开/page/article/fun.asp
二、搜索到public sub createlist(l1)
把public sub createlist(l1)
......
end sub这个函数替换成如下代码:(就是两个 ' *** Copyright © KingCMS.com All Rights Reserved. *** 之间)
---------------------------------------------------------------
public sub createlist(l1)
dim tmphtm,outhtm
dim tmphtmlist,tmplist
dim jshtm,jsnumber,zebra
dim rs,irs,i,j,data,datalist,pid,plist,pidcount,length,datalista,datalistb'pidcount 总页数
dim sql,suij,suijpagelist
dim jsorder,listid,listpath,listname
if len(l1)=0 then exit sub
sql="listid,listname,listpath,listtemplate1,listtemplate2,listtitle,listkeyword,listdescription"'7 datalist
set rs=conn.execute("select "&sql&" from kingart_list where listid in ("&l1&");")
if not rs.eof and not rs.bof then
datalist=rs.getrows()
else
redim datalist(0,-1)
end if
rs.close
set rs=nothing
sql="artid,listid,arttitle,artfrom,artdescription,artdate,artkeywords,artauthor,artpath,artimg,artgrade,artcontent"'10 data
for j=0 to ubound(datalist,2)
set rs=conn.execute("select listid,listid1 from kingart_list where listid="&datalist(0,j)&" or listid1="&datalist(0,j)&";")
if not rs.eof and not rs.bof then
datalista=rs.getrows()
for i=0 to ubound(datalista,2)'开始循环列表
if i=0 then
datalistb=datalista(0,i)
else
datalistb=datalistb&","&datalista(0,i)
end if
next
else
redim datalista(0,-1)
end if
rs.close
set rs=nothing
'分析模板及标签,并获得值
tmphtm=king.read(datalist(3,j),r_path&"[list]/"&datalist(4,j))'内外部模板结合后的htm代码
tmphtmlist=king.getlist(tmphtm,"article",1)'type="list"部分的tag,包括{king:/}
jshtm=king.getlabel(tmphtmlist,0)
jsorder=king.getlabel(tmphtmlist,"order")
if lcase(jsorder)="asc" then jsorder="asc" else jsorder="desc"
jsnumber=fix(king.getlabel(tmphtmlist,"number"))
zebra=king.getlabel(tmphtmlist,"zebra")
suij=chr(3)&salt(20)&chr(2)'随机出来的替换参数
suijpagelist=chr(3)&salt(16)&chr(2)
'把tmphtm中的{king:...type=list/}标签替换为一个随机的标签;pagelist设置为一个随机标签
tmphtm=replace(tmphtm,tmphtmlist,suij)
'替换模板中的标签
king.clearvalue
king.value "title",encode(htmlencode(datalist(5,j)))
king.value "listname",encode(htmlencode(datalist(1,j)))
king.value "listpath",encode(king.inst&datalist(2,j))
king.value "keywords",encode(htmlencode(datalist(6,j)))
king.value "description",encode(htmlencode(datalist(7,j)))
king.value "path",encode(king.inst&datalist(2,j))
king.value "pagelist",encode(suijpagelist)
king.value "listid",datalist(0,j)
king.value "guide",encode(guide(datalist(0,j))) '增加,可选的
tmphtm=king.create(tmphtm,king.invalue)
set rs=conn.execute("select "&sql&" from kingart where listid in ("&datalistb&") or listids like '%,"&datalist(0,j)&",%' order by artup desc,artorder "&jsorder&",artid "&jsorder&";")
if not rs.eof and not rs.bof then
data=rs.getrows()
'初始化变量值
pid=0
pidcount=(ubound(data,2)+1)/jsnumber:if pidcount>int(pidcount) then pidcount=int(pidcount)+1'总页数
length=ubound(data,2)'总记录数-1
for i=0 to length'开始循环列表
if cstr(listid)<>cstr(data(1,i)) then
listid=data(1,i)
set irs=conn.execute("select listname,listpath from kingart_list where listid="&listid&";")
if not irs.eof and not irs.bof then
listname=irs(0)
listpath=irs(1)
end if
irs.close
set irs=nothing
end if
king.clearvalue
king.value "content",data(11,i)
king.value "artid",data(0,i)
king.value "listid",data(1,i)
king.value "listname",encode(htmlencode(listname))
king.value "listpath",encode(king.inst&listpath)
king.value "title",encode(htmlencode(data(2,i)))
king.value "from",encode(formatfrom(data(3,i)))
king.value "description",encode(htmlencode(data(4,i)))
king.value "date",encode(htmlencode(data(5,i)))
king.value "keywords",encode(htmlencode(data(6,i)))
king.value "author",encode(htmlencode(data(7,i)))
king.value "image",encode(data(9,i))
king.value "path",encode(getpath(data(0,i),data(10,i),king.inst&listpath&"/"&data(8,i)))
king.value "zebra",king.mod2(i+1,zebra)
king.value "commentid",encode(r_path&"|"&data(0,i))'传递评论参数
tmplist=tmplist&king.createhtm(jshtm,king.invalue)'循环累加值到tmplist变量
if ((i+1) mod jsnumber)=0 or i=length then '当整除于number参数或到最后一个记录的时候进入生成过程
' if i=length then pid=pid+1
plist=pagelist(king.inst&datalist(2,j)&"/$",pid+1,pidcount,length+1)
outhtm=replace(tmphtm,suij,tmplist)
outhtm=replace(outhtm,suijpagelist,plist)
king.createfolder "../../"&datalist(2,j)
if pid=0 then'列表第一页
king.savetofile "../../"&datalist(2,j)&"/"&king_ext,outhtm
else
king.savetofile "../../"&datalist(2,j)&"/"&(pid+1)&"/"&king_ext,outhtm
end if
'初始化循环变量
tmplist=""
pid=pid+1
end if
next
else
outhtm=replace(tmphtm,suij,king.lang("error/rsnot"))
outhtm=replace(outhtm,suijpagelist,"")
king.savetofile "../../"&datalist(2,j)&"/"&king_ext,outhtm
end if
rs.close
set rs=nothing
next
end sub
kingcms5部分BUG修复和修改技巧由懒人建站收集整理,您可以自由传播,请主动带上本文链接
懒人建站就是免费分享,觉得有用就多来支持一下,没有能帮到您,懒人也只能表示遗憾,希望有一天能帮到您。
kingcms5部分BUG修复和修改技巧-最新评论