5ucms论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 6943|回复: 0
打印 上一主题 下一主题

[列表标签] 栏目/普通列表

[复制链接]

670

主题

785

帖子

8253

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
8253
跳转到指定楼层
楼主
发表于 2019-2-26 09:55:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
菜单调用 任意列表页统计当前CID下文章数 <!--5ucms.org:{ $Row=1 $Sql=Select Count([ID]) as cc From [{pre}Content] Where [Cid] in ({field:ChildIDs}) And [Display]=1 }-->[5ucms.org:cc]<!--5ucms.org-->
意思是 调用 20条       栏目       顺序大于-1的  排序按顺序从大到小 再按ID从新到旧
<!--m:{ $Row=20 $table=Channel $Where=[order]>-1 $order=[order] desc,[id] desc }-->
<a href="[m:curl]">[m:cname]</a>
<!--m-->
<a href="/">首页</a>
<!--m:{ $Row=10 $table=Channel $Where=[FatherID]=0 }-->
<a href="[m:curl]">[m:cname]</a>
<!--m-->
调用10条  栏目 父级ID为0的 意思是最顶级的栏目
<!--m:{ $Row=10 $table=Channel $Where=[FatherID]=0 }-->
<li><a href="[m:curl]">[m:cname]</a></li>
<!--m-->
<li><a href="/">首页</a></li><!--m:{ $Row=10 $table=Channel $Where=[FatherID]=0 }-->
<li><a href="[m:curl]">[m:cname]</a></li>
<!--m-->
高亮JS <script type="text/javascript">document.getElementById('aboutus').className = 'on';</script> 注:aboutus为栏目元素id,on为高亮CSS的CLASS菜单或内容链接单独调用
<!--m:{$table=channel $where=id=2}-->[m:curl]<!--m--><!--m:{$table=channel $where=id=2}--><a href="[m:curl]" title="[m:cname]"><!--m-->
<!--m:{$table=channel $where=id=2}--><a href="[m:curl]" title="[m:cname]">[m:cname]</a><!--m-->
<!--c:{$table=content $where=id=2}-->[c:aurl]<!--c--><!--c:{$table=content $where=id=2}--><a href="[c:aurl]" title="[c:title]"><!--c-->
简化标签 {curl:2}  {cname:23} {title:53} {aurl:123} 调对应数字的字段名 V2及VIP版可用
限制长度CSS 邱嵩松注:用len会导致数据截断,而用css不会截断,且不影响数据显示,超出一样会显示...
width:200px;white-space:nowrap;text-overflow:ellipsis;-o-text-overflow:ellipsis;overflow:hidden;

最新内容
<!--m:{ $row=8 $order=[order] desc,[id] desc }-->
•<a href="[m:aurl]" title="[m:title]">[m:titlex]</a><br>
<!--m-->
普通列表{if:[m:i]>1}<b> | </b>{end if}
<!--m:{ $row=8 $cid=1 $order=[order] desc,[id] desc }-->
<a href="[m:aurl]" title="[m:title]">[m:titlex]</a>
<!--m-->
推荐带图列表
<!--list:{ $row=8 $mode=commend $type=images $cid=1 $Order=[ID] Desc }-->
<a href="[List:aurl]" title="[List:title]"><img src=[list:indexpic $width=130 $height=110] width="130" height="110" onerror=this.src='/template/images/nophoto.gif' border="0" alt="[list:title]"></a>
<a href="[List:aurl]" title="[List:title]">[List:titlex $len=22 $lenext=...]</a>
<!--List-->
具体单个标签解释:
$mode=uncommend 调用非推荐文章
$type=noimages 调用无图片文章
[List:字段] 输出对应字段的值
[List:i] 表示输出的记录编号 [List:curl] 文章所属栏目链接地址
[list:cname] 栏目名称,需要读取表中name字段,如果这个栏目名称有HTML代码,而你又不想出现HTML代码就可以[list:cname $function=clearhtml] 去掉HTML代码
[List:aurl] 文章链接地址 $Order=Rnd(ID) 随机
[List:titlex $len=22 $lenext=...] 文章标题带属性(颜色+样式) [List:title $len=22 $lenext=...] 不带样式
[List:indexpic] 图片地址 {if:len("[List:indexpic]")>0}[List:indexpic]{end if} 当有图时显示图 没图就不显示
[list:comments] 评论数量 [list:description $len=50 $Lenext=...] [list:description $len=100 $Lenext=...] [list:description $len=150 $Lenext=...] [list:description $len=200 $Lenext=...] [list:description $len=255 $Lenext=...] 列表描述  这里最好统计下字数,点我统计
[List:createtime $format=yy-mm-dd hh:nn:ss] 生成时间 [List:createtime $format=yyyy-mm-dd hh:nn:ss] [List:createtime $format=yy-mm-dd] [List:createtime $format=yyyy-mm-dd]
[List:modifytime $format=yy-mm-dd hh:nn:ss] 修改时间 [List:modifytime $format=yyyy-mm-dd hh:nn:ss] [List:modifytime $format=yy-mm-dd] [List:modifytime $format=yyyy-mm-dd]
相关文章<!--about:{ $row=10 $mode=about $keys={field:keywords} $aid={field:id} }-->
•<a href="[about:aurl]" title="[about:title]">[about:titlex]</a><br />
<!--about-->
如何实现相关文章的显示和配置?
随机内容:<!--about:{ $row=10 $Sql=select * from [{pre}Content] where [Display]=1 Order by right(cstr(Rnd(-int([ID] +rnd(-timer())*100)))*1000*Now(),2) }-->
•<a href="[about:aurl]" title="[about:title]">[about:titlex]</a><br />
<!--about-->
这种随机的更彻底,比标签生成器的那个好,每刷新更新,生成时 重随机一次。静态化时被访问不会随机,如需静态化定时随机
可以考虑使用 5ucms定时更新插件 定时重生成内容 不用自己一次次地去静态发布了
相关文章(指定CID和排除CID的例子):
游客,如果您要查看本帖隐藏内容请回复
最新标志:在最新文章在后面显示
[list:titlex $len=44 $lenext=...] {IF:datediff("d",cdate("[list:createtime]"),now())=<2}New {End If}
每5条加一个HR标记:
{if:[list:i] mod 5=0}<hr>{end if}
用于填充表格 以3列为例:
<!--count:{ $Row=1 $Sql=Select Count([ID]) as cc From [{pre}Content] Where [id]>2832 and [id]<2850 and [cid]={Field:CID} }-->{if:[count:cc] mod 3=1} <td></td><td></td> {end if}  <!--count-->
<!--count:{ $Row=1 $Sql=Select Count([ID]) as cc From [{pre}Content] Where [id]>2832 and [id]<2850 and [cid]={Field:CID} }-->{if:[count:cc] mod 3=2} <td></td> {end if}  <!--count-->
栏目高亮:
{if:[menu:cid]={field:Fatherid} or [menu:cid]={field:cid}} class="on"{end if}
$Cache=10 缓存10秒,可提高效率
$Row=10 返回十个栏目
$Table=Channel 指定栏目表
$Order=[Order] Desc 按栏目权重走
$Field=[id],[name] 只读取id和name字段,提高效率
===================================================
底层标签扩展属性:
使用扩展属性时的基本语法 {field:字段名 属性名称=属性值}
$Format 格式字时间,只对于时间格式的字段有效,如 $Format=yyyy-mm-dd hh:nn:ss,yy表示二位年份,yyyy表示四位年份,mm dd hh nn ss 都以二位表示。
$Clearhtml 值等于True时清除字段的HTML标签。
$Len 获取字段指定长度的值,一个中文算二个字符。
$Lenext 表示在$Len截断后补上的字符。
$Replace 把字段值里的某些字符进行替换,如$Replace=a##A表示把字段值里的a替换成A,中间用##分隔。
$Function 使用函数,值有urlencode/htmlencode/abs/trim/ucase/lcase,多个函数可以一起使用,用,号分隔 。

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|5ucms.com

GMT+8, 2024-5-19 19:47 , Processed in 0.046875 second(s), 29 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表