`
jialisoft126
  • 浏览: 34073 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论

动易cms如何调用随机文章列表

阅读更多
通常我们打开网站网页,页面上显示出的文章标题列表都是以一定秩序排列显示的,如果能随着页面的不时刷新,文章标题排列秩序也发生变化,那么就显得网站比较生动活泼,下面我们就来开始进行实现此功能

1、添加标签
标签名称:{$MY_产生本月某栏目随机文章}----可自定义名称

查询语句:

  select top 10 ArticleID,ClassID,Title,UpdateTime from PE_Article where ChannelID ={input(0)} and DateDiff(day,UpdateTime,getdate())<30 and Deleted=0 and Status=3 Order by newid()

标签内容:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
{Loop}{Infobegin}
<tr>
<TD class=tblist vAlign=top width=10><IMG src="{$InstallDir}images/article_ontop.gif"></TD>
<td class=tblist><a class="listfont3" href="{$InstallDir}{$Field(0,GetUrl,Article,1)}" target="blank" title={$Field(2,Text,0,2,1)}>{$Field(2,Text,22,2,1)}</a></td>
</tr>
{Infoend}{/Loop}
</table>
<table>
<tr>//http://www.software8.co/
<td height=5></td>
</tr>
</table>

2、模板调用

在网页需要位置{$MY_产生本月某栏目随机文章(1002)},其中1002是对应你的频道ID的可以根据自己实际修改。
说明:本标签应用于SQL数据库,不适合AC数据库;查询语句中DateDiff(day,UpdateTime,getdate())<30其中30是查询一个月内的文章,这个数值可以根据网站自己实际情况做调整。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics