KingCMS 5.0 模板教程-分页标签的修改

[来源:1573net.com] [作者:tyx8023] [日期:2007-11-26] [热度:]

KingCMS 5.0系统自带的分页标签样式比较单薄,不便于设计新颖的风格,今天抽时间做了下修改,大家可以借鉴下:

1573net.com tyx8023原创,转载请保留此句。

打开系统目录下/page/system/fun.asp文件,找到以下内容:

第2371行

 

'pagelist  *** Copyright &copy KingCMS.com All Rights Reserved. ***
function pagelist(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>")'
 end if
 if l2>2 then
  l4=l4&("<a href="""&replace(l1,"$",l2-1)&""">&lsaquo;&lsaquo;</a>")
 elseif l2=2 then
  l4=l4&("<a href="""&replace(l1,"$","")&""">&lsaquo;&lsaquo;</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>")
    else
     l4=l4&("<a href="""&replace(l1,"$",k)&""">"&k&"</a>")
    end if
   end if
  end if
 next
 if l2<l3 and l3<>1 then
  l4=l4&("<a href="""&replace(l1,"$",l2+1)&""">&rsaquo;&rsaquo;</a>")
 end if
 if l2<l3-7 then
  l4=l4&("<a href="""&replace(l1,"$",l3)&""">... "&l3&"</a>")
 end if

 I2=split(l1,"$")
 
' l4=l4&"<kbd><input type=""text"" name=""pid"" size=""2"" onkeydown=""if(event.keyCode==13) {window.location='"&htm2js(I2(0))&"'+this.value+'"&htm2js(I2(1))&"'; return false;}"" /></kbd>"
 pagelist="<span class=""k_pagelist""><em>"&l5&"</em>"&l4&"</span>"
end function

 

修改为

 

'pagelist  *** Copyright &copy KingCMS.com All Rights Reserved. ***
'仿163 pagelist tyx8023 2007-11-24 改
function pagelist(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)
 l4=("<LI class=b1><a href="""&replace(l1,"$","")&""">首页</a></li>")
 
 if l2>1 then
  l4=l4&("<LI class=b3><a href="""&replace(l1,"$",l2-1)&""">上一页</a></li>")
 else
  l4=l4&("<LI class=b3>上一页</li>")
 end If
 
 for k=l2-2 to l2+7
  if k>=1 and k<=l3 then
   if cstr(k)=cstr(l2) then
    l4=l4&("<LI class=ba>"&k&"</li>")
   else
    if k=1 then
     l4=l4&("<LI class=b><a href="""&replace(l1,"$","")&""">"&k&"</a></li>")
    else
     l4=l4&("<LI class=b><a href="""&replace(l1,"$",k)&""">"&k&"</a></li>")
    end if
   end if
  end if
 Next
 if l2<l3 and l3<>1 then
       l4=l4&("<LI class=b3><a href="""&replace(l1,"$",l2+1)&""">下一页</a></li>")
 Else
    l4=l4&("<LI class=b3>下一页</li>")
 end if
 l4=l4&("<LI class=b2><a href="""&replace(l1,"$",l3)&""">尾页</a></li>")
 I2=split(l1,"$")
' l4=l4&"<kbd><input type=""text"" name=""pid"" size=""2"" onkeydown=""if(event.keyCode==13) {window.location='"&htm2js(I2(0))&"'+this.value+'"&htm2js(I2(1))&"'; return false;}"" /></kbd>"
 pagelist="<DIV class=pageRoll><DIV class=info>共"&l5&"篇教程</DIV><DIV class=page>"&l4&"<DIV class=clear></DIV></DIV></DIV>"
end function

通过这样修改,分页样式由原来的2种增加至6种,这样就可以设计出更多的漂亮模板了。

一网情深,为您提供免费的网络学习资源