kingcms修改笔记
2010-12-20 16:28
kingcms默认是文章路径是:文章标题/index.htm,一篇文章对应一个文件夹,不利于seo和网站管理,如果想修改成百度空间的文章路径:Item/文章标题.html,修改方法如下:
修改网页扩展名为html
打开KingCMS5.1\page\system\config.asp
将const king_ext = “index.htm”
修改为const king_ext = “index.html”
修改文章生成路径
打开KingCMS5.1\page\Article\fun.asp,将public sub createpage(l1)函数中的
artpath=pagepath(“../../”&datalist(1,0)&”/”&data(9,i),j)
替换为artpath=pagepath(“../../”&”Item/”&data(9,i)&”.”&split(king_ext,”.”)(1),j)
将if king.isfile(data(9,i))=false then artpath=artpath&king_ext这句用单引号注释掉
‘if king.isfile(data(9,i))=false then artpath=artpath&king_ext
修改首页文章超链接
经过以上修改虽然文章生成路径变了,但首页的文章链接还是系统默认的生成路径,打开KingCMS5.1\page\Article\fun.asp,将function king_tag_article(tag,invalue)函数中的
king.value “path”,encode(t_art.getpath(data(0,i),data(10,i),king.inst&datalist(1,0)&”/”&data(8,i)))
修改为king.value “path”,encode(t_art.getpath(data(0,i),data(10,i),king.inst&”Item/”&data(8,i)&”.”&split(king_ext,”.”)(1)))
修改文章分页生成路径
打开KingCMS5.1\page\Article\fun.asp,将public function pagepath(l1,l2)函数中的
pagepath=I2(1)&”/”&l2&I2(0)
修改为pagepath=I2(1)&”_”&l2+1&I2(0)
修改文章分页导航链接
修改文章分页生成路径后,分页导航链接还是默认的生成路径,打开KingCMS5.1\page\Article\fun.asp,将public sub createpage(l1)函数中的
king.value “pagelist”,encode(pageslist(king.inst&datalist(1,0)&”/”&data(9,i),j,ubound(contents),data(12,i),data(0,i)))
修改为king.value “pagelist”,encode(pageslist(king.inst&”Item/”&data(9,i)&”.”&split(king_ext,”.”)(1),j,ubound(contents),data(12,i),data(0,i)))
修改文章页“上一页”标签链接
打开KingCMS5.1\page\Article\fun.asp,将public sub createpage(l1)函数中的
king.value “nextpage”,encode(nextpage(data(0,i),data(11,i),data(1,i),datalist(1,0),tmphtm))
修改为king.value “nextpage”,encode(nextpage(data(0,i),data(11,i),data(1,i),datalist(1,0),tmphtm,datalist(0,0)))
将private function nextpage(l1,l2,l3,l4,l5)函数修改为private function nextpage(l1,l2,l3,l4,l5,l6),同时将本函数中的
I1=”<a href=”"”&getpath(rs(3),rs(1),king.inst&l4&”/”&rs(2))&”"”>”&htmlencode(rs(0))&”</a>”
修改为I1=”<a href=”"”&getpath(rs(3),rs(1),king.inst&”Item/”&rs(2)&”.”&split(king_ext,”.”)(1))&”"”>”&htmlencode(rs(0))&”</a><span class=”"date”">(“&formatdate(rs(4),”yyyy-MM-dd”)&”</span>”
将I1=”<script type=”"text/javascript”">posthtm(‘”&king.page&”article/page.asp?action=nextpage’,'k_nextpage’,'artid=”&l1&”‘);</script>”
修改为I1=”<a href=”"”&king.inst&l4&”/”">["&htmlencode(l6)&"]</a>”
将nextpage=”<span id=”"k_nextpage”">”&I1&”</span>”
修改为nextpage=I1
修改文章页“下一页”标签链接
打开KingCMS5.1\page\Article\fun.asp,将private function lastpage(l1,l2,l3,l4,l5,l6)函数中的
I1=”<a href=”"”&getpath(rs(3),rs(1),king.inst&l4&”/”&rs(2))&”"”>”&htmlencode(rs(0))&”</a>”
修改为I1=”<a href=”"”&getpath(rs(3),rs(1),king.inst&”Item/”&rs(2)&”.”&split(king_ext,”.”)(1))&”"”>”&htmlencode(rs(0))&”</a><span class=”"date”">(“&formatdate(rs(4),”yyyy-MM-dd”)&”</span>”
将lastpage=”<span id=”"k_lastpage”">”&I1&”</span>”
修改为lastpage=I1
交换文章页“上一页”、“下一页”标签
可能是和开发者的理解不同,“上一页”应该是比当前文章发布时间迟一点的那篇文章,“下一页”应该是比当前文章发布时间早一点的那篇文章,而在kingcms中恰恰相反。打开KingCMS5.1\template\inside\article[page]\default.htm,将{king:lastpage/}和{king:nextpage/}互换即可。
修改列表页的文章链接
打开KingCMS5.1\page\Article\fun.asp,将public sub createlist1(l1,l2)函数中的
king.value “path”,encode(getpath(dp.data(0,i),dp.data(10,i),king.inst&listpath&”/”&dp.data(8,i)))
修改为king.value “path”,encode(getpath(dp.data(0,i),dp.data(10,i),king.inst&”Item/”&dp.data(8,i)&”.”&split(king_ext,”.”)(1)))
修改列表页分页生成路径
打开KingCMS5.1\page\Article\fun.asp,将public sub createlist1(l1,l2)函数中的
king.savetofile “../../”&datalist(2,0)&”/”&pid&”/”&king_ext,outhtm
修改为king.savetofile “../../”&datalist(2,0)&”/”&pid&”.”&split(king_ext,”.”)(1),outhtm
修改列表页导航链接
打开KingCMS5.1\page\system\fun.asp,将function pagelist(l1,l2,l3,l5)函数中的
l4=l4&(“<a href=”"”&replace(l1,”$”,l2-1)&”"”>‹‹</a>”)
修改为l4=l4&(“<a href=”"”&replace(l1,”$/”,l2-1)&”.”&split(king_ext,”.”)(1)&”"”>上一页</a>”)
将l4=l4&(“<a href=”"”&replace(l1,”$”,”")&”"”>‹‹</a>”)
修改为l4=l4&(“<a href=”"”&replace(l1,”$/”,”")&”"”>上一页</a>”)
将l4=l4&(“<a href=”"”&replace(l1,”$”,k)&”"”>”&k&”</a>”)
修改为l4=l4&(“<a href=”"”&replace(l1,”$/”,k)&”.”&split(king_ext,”.”)(1)&”"”>”&k&”</a>”)
将l4=l4&(“<a href=”"”&replace(l1,”$”,l2+1)&”"”>››</a>”)
修改为l4=l4&(“<a href=”"”&replace(l1,”$/”,l2+1)&”.”&split(king_ext,”.”)(1)&”"”>下一页</a>”)
将l4=l4&(“<a href=”"”&replace(l1,”$”,l3)&”"”>… “&l3&”</a>”)
修改为l4=l4&(“<a href=”"”&replace(l1,”$/”,l3)&”.”&split(king_ext,”.”)(1)&”"”>..”&l3&”</a>”)
修改文章评论
打开KingCMS5.1\page\comment\language\zh-cn.xml,将<guest>Guest</guest>修改为<guest>匿名用户</guest>
打开KingCMS5.1\page\comment\fun.asp,将public sub create(l1)中的
king.value “username”,encode(kc.lang(“common/guest”))
修改为king.value “username”,”<span class=”"from”">”&encode(kc.lang(“common/guest”))&”</span> <span class=”"ip”">ip:”&encode(htmlencode(data(3,i)))&”</span>”
将king.value “quote”,encode(“<a href=”"#k_comment_post”"
修改为king.value “quote”,encode(“ <a href=”"javascript:;”"
进入后台,模块管理->评论管理->评论参数,将“循环体模板”修改为:
{king:comment number=”2″}
<div><span class=”postTime”>(king:date mode=”yyyy-MM-dd hh:mm:ss”/) 发表
</span><strong>(king:floor/)</strong>(king:username/)</div>
<p>(king:content/)</p>
<ul class=”operations”><li>(king:good/)</li><li>(king:bad/)</li><li>(king:quote/)</li></ul>
<div class=”line”></div>
{/king}
打开KingCMS5.1\template\images\style.css,将/* 评论 */部分的CSS修改为:
/* 评论 */
#k_comment{text-align:left;}
#k_comment div{display:block;clear:both;}
#k_comment .from{color: #1e50a2;}
#k_comment .ip{color: #666;}
#k_comment .postTime { color: #666; float:right;}
#k_comment .operations {color: #1e50a2; float: right; list-style-type: none;}
#k_comment .operations li { float: left; padding-left: 1.2em;}
#k_comment div.line{margin:8px 0;border-top:1px dashed #A6A6A6;}
#k_comment div strong {margin-right:15px; color: #666;}
#k_comment p{line-height:22px;margin:5px 0;}
#k_comment .k_pagelist{clear:both;display:block;}
#k_comment_post{display:block;clear:both;text-align:left;font-size:14px;}
修改文章评论分页生成路径
打开KingCMS5.1\page\comment\fun.asp,将public sub create(l1)中的
plist=kpagelist(“javascript:;”" onclick=”"gethtm(‘”&king.inst&r_path&”/”&I2(0)&”/”&I2(1)&”/$”&”‘,’k_comment’)”,pid+1,pidcount,length+1)
修改为plist=kpagelist(“javascript:;”" onclick=”"gethtm(‘”&king.inst&r_path&”/”&I2(0)&”_”&I2(1)&”_$”&”‘,’k_comment’)”,pid+1,pidcount,length+1)
将king.savetofile “../../”&r_path&”/”&I2(0)&”/”&I2(1)&”/”&king_ext,plist&tmplist&plist
修改为king.savetofile “../../”&r_path&”/”&I2(0)&”_”&I2(1)&”_”&king_ext,plist&tmplist&plist
将king.savetofile “../../”&r_path&”/”&I2(0)&”/”&I2(1)&”/”&(pid+1)&”/”&king_ext,plist&tmplist&plist
修改为king.savetofile “../../”&r_path&”/”&I2(0)&”_”&I2(1)&”_”&(pid+1)&”.”&split(king_ext,”.”)(1),plist&tmplist&plist
将king.savetofile “../../”&r_path&”/”&I2(0)&”/”&I2(1)&”/”&king_ext,”<p>”&lang(“common/notcomment”)&”</p>”
修改为king.savetofile “../../”&r_path&”/”&I2(0)&”_”&I2(1)&”_”&king_ext,”<p>”&lang(“common/notcomment”)&”</p>”
将function kpagelist(l1,l2,l3,l5)函数修改为:
function kpagelist(l1,l2,l3,l5)
if instr(l1,”$”)=0 then exit function
if l5=0 then exit function
dim l4,k,l6,l7,I2
l2=int(l2):l3=int(l3):l5=int(l5)
if l2>3 then
‘l4=(“<a href=”"”&replace(l1,”$”,”")&”"”>1 …</a>”)’
l4=(“<a href=”"”&replace(l1,”$”,king_ext)&”"”>1 …</a>”)’
end if
if l2>2 then
‘l4=l4&(“<a href=”"”&replace(l1,”$”,l2-1)&”"”>‹‹</a>”)
l4=l4&(“<a href=”"”&replace(l1,”$”,(l2-1)&”.”&split(king_ext,”.”)(1))&”"”>‹‹</a>”)
elseif l2=2 then
‘l4=l4&(“<a href=”"”&replace(l1,”$”,”")&”"”>‹‹</a>”)
l4=l4&(“<a href=”"”&replace(l1,”$”,king_ext)&”"”>‹‹</a>”)
end if
for k=l2-2 to l2+7
if k>=1 and k<=l3 then
if cstr(k)=cstr(l2) then
l4=l4&(“<strong>”&k&”</strong>”)
else
if k=1 then
‘l4=l4&(“<a href=”"”&replace(l1,”$”,”")&”"”>”&k&”</a>”)
l4=l4&(“<a href=”"”&replace(l1,”$”,king_ext)&”"”>”&k&”</a>”)
else
‘l4=l4&(“<a href=”"”&replace(l1,”$”,k)&”"”>”&k&”</a>”)
l4=l4&(“<a href=”"”&replace(l1,”$”,k&”.”&split(king_ext,”.”)(1))&”"”>”&k&”</a>”)
end if
end if
end if
next
if l2<l3 and l3<>1 then
‘l4=l4&(“<a href=”"”&replace(l1,”$”,l2+1)&”"”>››</a>”)
l4=l4&(“<a href=”"”&replace(l1,”$”,(l2+1)&”.”&split(king_ext,”.”)(1))&”"”>››</a>”)
end if
if l2<l3-7 then
‘l4=l4&(“<a href=”"”&replace(l1,”$”,l3)&”"”>… “&l3&”</a>”)
l4=l4&(“<a href=”"”&replace(l1,”$”,l3&”.”&split(king_ext,”.”)(1))&”"”>… “&l3&”</a>”)
end if
I2=split(l1,”$”)
kpagelist=”<span class=”"k_pagelist”">”&l4&”</span>”
end function
将function king_tag_comment(tag,invalue)函数中的
I3=t_kc.path&”/”&I2(0)&”/”&I2(1)&”/”&king_ext
修改为I3=t_kc.path&”/”&I2(0)&”_”&I2(1)&”_”&king_ext
打开KingCMS5.1\page\comment\index.asp,将sub king_post()函数中的
I1=I1&”<p><a href=”"javascript:;”" onclick=”"gethtm(‘/”&kc.path&”/”&I2(0)&”/”&I2(1)&”/”&king_ext&”‘,’k_comment’)”">”&kc.lang(“common/raw”)&”</a></p>”
修改为I1=I1&”<p><a href=”"javascript:;”" onclick=”"gethtm(‘/”&kc.path&”/”&I2(0)&”_”&I2(1)&”_”&king_ext&”‘,’k_comment’)”">”&kc.lang(“common/raw”)&”</a></p>”
修正心情投票插件mood.js中的错误
$(“moodinfo”+j).innerHTML = “<span style=\’color: #555555;padding-left: 20px;font-size:16px;’>您看完此刻的感受是! 已有<font color=’#FF0000′>”+moodzs+”</font>人表态:</span>”;
修改为$(“moodtitle”).innerHTML = “<span style=\’color: #555555;padding-left: 20px;font-size:16px;’>您看完此刻的感受是! 已有<font color=’#FF0000′>”+moodzs+”</font>人表态:</span>”;
由于这个错误,心情投票只有下面的表情图片,而没有上面的统计数据。
修改位置导航标签{king:guide/}的解析代码
默认生成的代码:<a href=”/” class=”k_guidename”>当前位置</a><a href=”栏目路径”>栏目名称</a> >> 文章标题
修改后:<a href=”/”>首页</a> > <a href=”栏目路径”>栏目名称</a> > 正文
修改方法:打开KingCMS5.1\admin\system\plugin.asp,将function lIll(l1,invalue)函数中的
str=”<a href=”"/”" class=”"k_guidename”">”&l2&”</a>”&str
修改为str=”<a href=”"/”">”&l2&”</a> > “&str
打开KingCMS5.1\page\Article\fun.asp,将public sub createpage(l1)函数中的
king.value “guide”,encode(guide(listid)&” >> “&htmlencode(data(2,i)))
修改为king.value “guide”,encode(guide(listid)&” > 正文”)
(未完待续)