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

KingCMS5.1 zebra 斑马线实现自定义输出

1Next >

dujun0618 发表于:11-12-16 16:29 [添加收藏] 楼主 [回复] #Top#
dujun0618 人气:149 积分:7 金币:26656

由于zebra 斑马线,必须为数字,如zebra="2",当第2、4、8等整除于zebra参数值的时候,输出1,其他输出0

这样比较不灵活,必须得输出0,1,有时候不需要输出,比如要实现5行之间有斑马线,只要在第5行后输出就行了,而且有时要输出特殊字符串,这样就得对函数进行修改了。

page/system/fun.asp文件,下面红色部分就自己加的代码,如果要看效果可以看本网站的首页与频道页
public function mod2(l1,l2)
 if l2=4 then
  if l1=4 then
   mod2="</ul><span class=""dotline""></span><ul class=""list"">"
  else
   mod2=""
  end if
  exit function
 end if
 if l2=6 then
  if l1=6 then
   mod2="</ul><span class=""dotline""></span><ul class=""list"">"
  else
   mod2=""
  end if
  exit function
 end if
 
if int(l1) mod int(l2) then
  mod2=1
 else
  mod2=0
 end if
end function
文章出处:IT618资讯网(http://www.cnit618.com/html/kyxt/kingcms/914.htm)

caiyangjun 发表于:11-12-16 23:18 沙发 [回复] #Top#
caiyangjun 人气:0 积分:111 金币:80
红色的代码看不懂啊
njy1239 发表于:11-12-17 10:59 板凳 [回复] #Top#
njy1239 人气:0 积分:20 金币:40
还是有些不大明白啊
dujun0618 发表于:11-12-17 12:58 编辑于:12-17 12:59 4楼 [回复] #Top#
dujun0618 人气:149 积分:7 金币:26656
实例:
<ul class="list">
{king:article type="new" number="12" zebra="6"}
<li><a href="(king:path/)" >(king:title/)</a></li>
(king:zebra/)
{/king}
</ul>

就是当zebra="4"或zebra="6"时,l2就是4或6,你也可设成7,8,9等看实际需要
下面代码中当l2等于4时,(king:zebra/)输出:
</ul><span class="dotline"></span><ul class="list">

下面代码中当l2等于6时,(king:zebra/)输出:
</ul><span class="dotline"></span><ul class="list">

输出什么可以自己设置

public function mod2(l1,l2)
 if l2=4 then
  if l1=4 then
   mod2="</ul><span class=""dotline""></span><ul class=""list"">"
  else
   mod2=""
  end if
  exit function
 end if
 if l2=6 then
  if l1=6 then
   mod2="</ul><span class=""dotline""></span><ul class=""list"">"
  else
   mod2=""
  end if
  exit function
 end if
 
if int(l1) mod int(l2) then
  mod2=1
 else
  mod2=0
 end if
end function
124.193.204.* 发表于:12-12-04 16:34 5楼 [回复] #Top#
KingCMS官方网站网友
这种方法貌似不是每五个输出一次,而是只输出一次
vvka 发表于:16-05-25 15:52 6楼 [回复] #Top#
vvka 人气:140 积分:560 金币:2608
KC元老
记号..........

我的改法:
public function mod2(l1,l2)
if int(l1) mod int(l2) then
mod2=""
else
mod2="<hr />"
end if
end function


1Next >

发表回复

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

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

Copyright © 2004-2015 Focuznet All rights reserved.

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