现在举例说明
1. <!--{block name="spacenews" parameter="dateline/2592000/grade/4/showattach/1/showdetail/1/catid/1,2/order/i.dateline DESC/limit/0,1/subjectlen/34/subjectdot/1/messagelen/80/messagedot/1/cachetime/18600/cachename/headnews/tpl/data"}-->
复制代码
1、 name="spacenews" 意思是规定调用资讯模块的内容
2、 grade/4/ 调用审核等级为4的内容
3、 showattach/1 是否显示图片附件1为显示 0 为不显示
3、 showdetail/1 是否显示缩略信息1为显示 0为不显示
4、 order/i.dateline 按照发布时间排序
5、 limit/0,1 0是从头一条开始 1是调用1条
6、 subjectlen/34 调用标题的字节数
7、 subjectdot/1 标题是够显示省略号1为显示 0 为不显示
8、 messagelen/80 缩略内容显示字节数
9、 messagedot/1 缩略内容是否显示省略号
10、cachetime/18600 缓存更新时间
11、cachename/headnews 调用变量的名称
12、dateline/2592000 调用的时间范围
13、catid/1,2 调用的频道限制
subjectlen/34/subjectdot/1/
常用:
goodrate 好评排序
viewnum 点击排序
dateline 发布时间排序
lastpost 最后回复时间排序
replynum 回复排序
三、资讯篇
1、资讯根分类列表
1. <!--{block name="category" parameter="type/news/isroot/1/ischannel/2/order/c.displayorder/limit/0,100/cachetime/10800/cachename/category/tpl/data"}-->
2. <!--{loop $_SBLOCK['category'] $value}-->
3. <li><a href="$value[url]" target="_self">$value[name]</a></li>
4. <!--{/loop}-->
复制代码
2、资讯最新主题列表(以等级2为例)
1. <!--{block name="spacenews" parameter="grade/2/order/i.dateline DESC/limit/0,10/subjectlen/30/subjectdot/1/cachetime/18000/cachename/recommend2news/tpl/data"}-->
2. <!--{loop $_SBLOCK['recommend2news'] $value}-->
3. <li><a href="$value[url]" title="$value[subjectall]">$value[subject]</a></li>
4. <!--{/loop}-->
5.
复制代码
-----说明:grade/2/ recommend2news表示等级2,余类推。
3、图文资讯幻灯片
1. <!--{block name="spacenews" parameter="grade/4/haveattach/1/showattach/1/order/i.dateline DESC/limit/0,4/cachetime/11930/cachename/picnews/tpl/data"}-->
2. <div>
3. <!--{eval $picarr=$linkarr=$textarr=array();}-->
4. <!--{loop $_SBLOCK['picnews'] $ikey $value}-->
5. <!--{eval $picarr[] = '"'.$value[a_filepath].'"';}-->
6. <!--{eval $linkarr[] = '"'.$value[url].'"';}-->
7. <!--{eval $textarr[] = '"'.$value[subject].'"';}-->
8. <!--{/loop}-->
9. <!--{eval $pics = implode(',', $picarr);}-->
10. <!--{eval $links = implode(',', $linkarr);}-->
11. <!--{eval $texts = implode(',', $textarr);}-->
12. <script type="text/javascript" language="javascript">
13. <!--
14. var focus_width=208;
15. var focus_height=208;
16. var text_height=20;
17.
18. var xsImgs = new Array({$pics});
19. var xsImgLinks = new Array({$links});
20. var xsImgTexts = new Array({$texts});
21. var xsImgSize = new Array(focus_width, focus_height);
22. //-->
23. </script>
24. <script language="javascript" type="text/javascript" src="{S_URL}/include/js/slide.js"></script>
25. </div>
复制代码
4、头条新闻列表(内容截取、略图):
1. <!--{block name="spacenews" parameter="grade/5/showattach/1/showdetail/1/order/i.dateline DESC/limit/0,1/subjectlen/34/subjectdot/1/messagelen/80/messagedot/1/cachetime/18600/cachename/headnews/tpl/data"}-->
2. <!--{loop $_SBLOCK['headnews'] $value}-->
3. <!--{if !empty($value['a_thumbpath'])}--><a href="$value[url]"><img src="$value[a_thumbpath]" alt="" /></a><!--{/if}-->
4. <strong><a href="$value[url]">$value[subject]</a></strong>
5. <p>$value[message]</p>
6. <!--{/loop}-->
复制代码
5、站内最新资讯列表
1. <!--{block name="spacenews" parameter="order/i.dateline DESC/limit/0,15/showspacename/1/subjectlen/40/subjectdot/1/cachetime/1800/cachename/newgradenews/tpl/data"}-->
2. <!--{loop $_SBLOCK['newgradenews'] $value}-->
3. <li><cite>#date("m-d", $value["dateline"])# </cite><a href="$value[url]">$value[subject]</a></li>
4. <!--{/loop}-->
5.
复制代码
6、最热资讯TAG列表
1. <!--{block name="tag" parameter="order/spacenewsnum DESC/limit/0,20/cachetime/18000/cachename/hottag/tpl/data"}-->
2. <!--{loop $_SBLOCK['hottag'] $value}-->
3. <a href="$value[url]">$value[tagname]<em>($value[spacenewsnum])</em></a>
4. <!--{/loop}-->
复制代码
7、站内热门资讯列表(一周)--以浏览数
1. <!--{block name="spacenews" parameter="dateline/604800/order/i.viewnum DESC/limit/0,10/cachetime/15400/subjectlen/40/subjectdot/1/cachename/hotnews1/tpl/data"}-->
2. <!--{loop $_SBLOCK['hotnews1'] $value}-->
3. <li><cite>#date("m-d", $value["dateline"])# </cite><a href="$value[url]">$value[subject]</a>($value[viewnum])</li>
4. <!--{/loop}-->
5.
复制代码
8、站内热门资讯列表(一月)--以浏览数
1. <!--{block name="spacenews" parameter="dateline/2592000/order/i.viewnum DESC/limit/0,10/cachetime/17200/subjectlen/40/subjectdot/1/cachename/hotnews2/tpl/data"}-->
2. <!--{loop $_SBLOCK['hotnews2'] $value}-->
3. <li><cite>#date("m-d", $value["dateline"])# </cite><a href="$value[url]">$value[subject]</a>($value[viewnum])</li>
4. <!--{/loop}-->
复制代码
9、站内热门资讯列表(开站以来)--以浏览数
1. <!--{block name="spacenews" parameter="order/i.viewnum DESC/limit/0,10/cachetime/17400/subjectlen/40/subjectdot/1/cachename/hotnews3/tpl/data"}-->
2. <!--{loop $_SBLOCK['hotnews3'] $value}-->
3. <li><cite>#date("m-d", $value["dateline"])# </cite><a href="$value[url]">$value[subject]</a>($value[viewnum])</li>
4. <!--{/loop}-->
复制代码
10、图片资讯(略图、标题)
1. <!--{block name="spacenews" parameter="haveattach/1/showattach/1/order/i.dateline DESC/subjectlen/12/subjectdot/1/limit/0,7/cachetime/8000/cachename/picnews/tpl/data"}-->
2. <!--{loop $_SBLOCK['picnews'] $value}-->
3. <li><div><a href="$value[url]"><img src="$value[a_thumbpath]" alt="$value[subjectall]" /></a></div>
4. <p><a href="$value[url]">$value[subject]</a></p></li>
5. <!--{/loop}-->
复制代码
11、站内热门资讯列表(一周)---按评论数
1. <!--{block name="spacenews" parameter="lastpost/604800/order/i.replynum DESC/limit/0,10/cachetime/15400/subjectlen/40/subjectdot/1/cachename/replyhot/tpl/data"}-->
2. <!--{loop $_SBLOCK['replyhot'] $value}-->
3. <a href="$value[url]">$value[subject]</a><br/>
4. #date("m-d", $value["lastpost"])# / <a href="$value[url]">评论($value[replynum])</a>
5. <!--{/loop}-->
复制代码
12、最新发表(含评论)资讯列表
1. <!--{block name="spacenews" parameter="order/i.lastpost DESC/limit/0,20/cachetime/1500/cachename/newnews/tpl/data"}-->
2. <!--{loop $_SBLOCK['newnews'] $value}-->
3. <a href="$value[url]">$value[subject]</a><br/>
4. #date("m-d", $value["lastpost"])# / <a href="$value[url]">评论($value[replynum])</a>
5. <!--{/loop}-->
复制代码
13、月度关注热点---按评论数
1. <!--{block name="spacenews" parameter="lastpost/2592000/order/i.replynum DESC/limit/0,50/cachetime/35400/subjectlen/40/subjectdot/1/cachename/replyhot/tpl/data"}-->
2. <!--{loop $_SBLOCK['replyhot'] $value}-->
3. <a href="$value[url]">$value[subject]</a>
4. #date("m-d", $value["lastpost"])# / <a href="$value[url]">评论($value[replynum])</a>
5. <!--{/loop}-->
复制代码
14、各分类最新资讯列表
1. <!--{loop $_SBLOCK['category'] $ckey $cat}-->
2. <!--{eval $ctime=1800+30*$ckey;}-->
3. <!--{block name="spacenews" parameter="catid/$cat[subcatid]/order/i.dateline DESC/limit/0,10/cachetime/$ctime/subjectlen/40/subjectdot/1/cachename/newslist/tpl/data"}-->
4. <div class="category">
5. <h3>
6. <strong><a href="#action/category/catid/$cat[catid]#" target="_self">$cat[name]</a></strong>
7. <a href="#action/category/catid/$cat[catid]#" class="more" target="_self">更多</a>
8. </h3>
9. <ul class="msgtitlelist">
10. <!--{loop $_SBLOCK['newslist'] $value}-->
11. <li><cite>#date("m-d", $value["dateline"])# </cite><a href="$value[url]">$value[subject]</a></li>
12. <!--{/loop}-->
13. </ul>
14. </div>
15. <!--{/loop}-->
复制代码
15、当前分类月度关注热点----按浏览数
1. <!--{block name="spacenews" parameter="catid/$thecat[subcatid]/dateline/2592000/order/i.viewnum DESC/limit/0,10/cachetime/28800/cachename/hotnews/tpl/data"}-->
2. <!--{loop $_SBLOCK['hotnews'] $value}-->
3. <a href="$value[url]">$value[subject]</a><br/>
4. <a href="#uid/$value[uid]/action/space#">$value[username]</a> / <a href="$value[url]">点击($value[viewnum])</a>
5. <!--{/loop}-->
复制代码
16、当前分类最新资讯
1. <!--{block name="spacenews" parameter="catid/$thecat[subcatid]/order/i.dateline DESC/limit/0,10/cachetime/7280/cachename/newnews/tpl/data"}-->
2. <!--{loop $_SBLOCK['newnews'] $value}-->
3. <a href="$value[url]">$value[subject]</a>
4. <!--{/loop}-->
复制代码
17、当前资讯相关文章-->
1. <!--{if !empty($news[relativeitemids])}-->
2. <!--{block name="spacenews" parameter="itemid/$news[relativeitemids]/order/i.dateline DESC/limit/0,20/cachetime/17680/cachename/relativeitem/tpl/data"}-->
3. <!--{loop $_SBLOCK['relativeitem'] $ikey $value}-->
4. <a href="$value[url]" target="_blank" title="$value[subjectall]">$value[subject]</a>
5. <!--{/loop}-->
6. <!--{/if}-->
复制代码
18、资讯浏览页:
标题:$news[subject]
作者:$news[newsauthor]
时间:#date('Y-n-d H:i', $news["dateline"])#
来源: $news[newsfrom]
内容:$news[message]
图片附件:
1. <!--{loop $news['attacharr'] $attach}-->
2. <br /><a href="$attach[url]" target="_blank"><img src="$attach[thumbpath]" alt="$attach[subject]" /></a><br />$attach[subject]<br />
3. <!--{/loop}-->
4. <br />
复制代码
TAG:
1. <!--{if !empty($relativetagarr)}-->
2. <br /><strong>TAG:</strong>
3. <!--{loop $relativetagarr $value}-->
4. <!--{eval $svalue = rawurlencode($value);}-->
5. <a href="#action/tag/tagname/$svalue#" target="_blank">$value</a>
6. <!--{/loop}-->
7. <!--{/if}-->
复制代码
分页:$multipage
19、查看最新评论:
1. <!--{if !empty($commentlist)}-->
2. <div id="commentlist">
3. <h3>
4. <a href="#action/viewcomment/itemid/$news[itemid]#" class="more" target="_self">查看全部评论($news[replynum])</a>
5. <strong>最新评论</strong>
6. </h3>
7. <ul class="messagelist">
8. <!--{loop $commentlist $value}-->
9. <li>
10. <h4><a href="#action/viewcomment/itemid/$value[itemid]/cid/$value[cid]/op/delete/php/1#" class="more">删除</a>
11. <!--{if empty($value[authorid])}-->
12. $value[author]
13. <!--{else}-->
14. <a href="{B_URL}/viewpro.php?uid=$value[authorid]" target="_blank">$value[author]</a>
15. <!--{/if}-->
16. <span class="smalltxt">(#date("Y-n-d H:i:s", $value["dateline"])#, 评 <strong>$value[rates]</strong> 分)</span></h4>
17. <p>$value[message]</p>
18. </li>
19. <!--{/loop}-->
20. </ul>
21. </div>
22. <!--{/if}-->
复制代码
20、内容页多媒体及图片链接作用js:
1. <script language="javascript" type="text/javascript">
2. <!--
3. addMediaAction('articlebody');
4. addImgLink("articlebody");
5. //-->
6. </script>
复制代码
21、资讯当前类别封面图片及简介:
1. <!--{if $thecat['thumb'] || $thecat['note']}-->
2. <div>
3. <!--{if $thecat['thumb']}-->
4. <div><img src="{A_URL}/$thecat[thumb]" alt="" /></div>
5. <!--{/if}-->
6. <!--{if $thecat['note']}-->
7. <p>$thecat[note]</p>
8. <!--{/if}-->
9. </div>
10. <!--{/if}-->
复制代码
22、当前类别资讯子分类
1. <!--{block name="category" parameter="upid/$thecat[catid]/ischannel/2/order/c.displayorder/limit/0,100/cachetime/10900/cachename/subarr/tpl/data"}-->
2. <!--{if $_SBLOCK['subarr']}-->
3. <!--{loop $_SBLOCK['subarr'] $value}-->
4. <li><a href="$value[url]" target="_self">$value[name]</a></li>
5. <!--{/loop}-->
6. <!--{/if}-->
复制代码
23、当前类别资讯子分类列表
1. <!--{block name="category" parameter="upid/$thecat[catid]/ischannel/1/showattach/1/order/c.displayorder/limit/0,100/cachetime/16400/cachename/channel/tpl/data"}-->
2. <!--{if $_SBLOCK['channel']}-->
3. <!--{loop $_SBLOCK['channel'] $value}-->
4. <li>
5. <a href="#action/category/catid/$value[catid]#" target="_self"><img src="$value[thumb]" alt="" /></a>
6. <p><a href="#action/category/catid/$value[catid]#" target="_self">$value[name]</a></p>
7. </li>
8. <!--{/loop}-->
9. <!--{/if}-->
复制代码
24、当前类别根分类最新资讯列表
1. <!--{if $_SGET['page']<2 || empty($_SGET['mode'])}-->
2. <!--{block name="spacenews" parameter="perpage/40/catid/$thecat[subcatid]/order/i.dateline DESC/cachename/newlist/tpl/data"}-->
3. <!--{if $_SBLOCK['newlist']}-->
4. <div class="category">
5. <h3><strong>$thecat[name]</strong></h3>
6. <ul class="msgtitlelist">
7. <!--{loop $_SBLOCK['newlist'] $value}-->
8. <li><cite>#date("m-d", $value["dateline"])# </cite><a href="$value[url]">$value[subject]</a></li>
9. <!--{/loop}-->
10. </ul>
11.
12. <div class="pages">
13. <!--{if $_SBLOCK[newlist_multipage]}-->
14. $_SBLOCK[newlist_multipage]
15. <!--{else}-->
16. <table summary="" class="xspace-page"><tr><td class="xspace-totlerecord">当前只有一页</td></tr></table>
17. <!--{/if}-->
18. </div>
19. </div>
20. <!--{/if}-->
21. <!--{/if}-->
复制代码
25、当前类别关联论坛最新帖子:
1. <!--{if !empty($thecat['bbsmodel'])}-->
2. <!--{if $_SGET['page']<2 || !empty($_SGET['mode'])}-->
3. <!--{eval $_SGET['mode']='bbs';}-->
4. <!--{block name="bbsthread" parameter="perpage/40/$thecat[blockparameter]/cachename/bbsthreadlist/tpl/data"}-->
5. <!--{if $_SBLOCK['bbsthreadlist']}-->
6. <!--{loop $_SBLOCK['bbsthreadlist'] $value}-->
7. <li><cite>#date("m-d", $value["dateline"])# </cite><a href="$value[url]">$value[subject]</a></li>
8. <!--{/loop}-->
9. <div class="pages">
10. <!--{if $_SBLOCK[bbsthreadlist_multipage]}-->
11. $_SBLOCK[bbsthreadlist_multipage]
12. <!--{else}-->
13. <table summary="" class="xspace-page"><tr><td class="xspace-totlerecord">当前只有一页</td></tr></table>
14. <!--{/if}-->
15. </div>
16. <!--{/if}-->
17. <!--{/if}-->
18. <!--{/if}-->
复制代码
26、当前类别子分类资讯列表
1. <!--{if $_SGET['page']<2}-->
2. <!--{loop $_SBLOCK['subarr'] $ckey $cat}-->
3. <!--{eval $ctime=1800+30*$ckey;}-->
4. <!--{block name="spacenews" parameter="catid/$cat[subcatid]/order/i.dateline DESC/limit/0,10/cachetime/$ctime/cachename/subnewlist/tpl/data"}-->
5. <!--{if $_SBLOCK['subnewlist']}-->
6. <div class="category">
7. <h3>
8. <strong><a href="#action/category/catid/$cat[catid]#" target="_self">$cat[name]</a></strong>
9. <a href="#action/category/catid/$cat[catid]#" class="more" target="_self">更多</a>
10. </h3>
11. <ul class="msgtitlelist">
12. <!--{loop $_SBLOCK['subnewlist'] $value}-->
13. <li><cite>#date("m-d", $value["dateline"])# </cite><a href="$value[url]">$value[subject]</a></li>
14. <!--{/loop}-->
15. </ul>
16. </div>
17. <!--{/if}-->
18. <!--{/loop}-->
19. <!--{/if}-->
20.
21. 27、当前资讯评论:
22. <div id="commentlist">
23. <h3 style="text-align: center;"><strong>评论 << <a href="#action/viewnews/itemid/$item[itemid]#">$item[subject]</a> >></strong></h3>
24. <h5 style="margin: 1em 0; font-size: 1em;">
25. 查看数: $item[viewnum] /
26. 评论数: $item[replynum] /
27. 好评分: $item[goodrate] /
28. 差评分: $item[badrate]
29. </h5>
30. <ul class="messagelist">
31. <!--{loop $iarr $value}-->
32. <li>
33. <h4><a href="#action/viewcomment/itemid/$value[itemid]/cid/$value[cid]/op/delete/php/1#" class="more">删除</a>
34. <!--{if empty($value[authorid])}-->$value[author]<!--{else}--><a href="{B_URL}/viewpro.php?uid=$value[authorid]" target="_blank">$value[author]</a><!--{/if}-->
35. <span class="smalltxt">(第{$value[num]}楼, #date("Y-n-d H:i:s", $value["dateline"])#, 评 <strong>$value[rates]</strong> 分)</span></h4>
36. <p>$value[message]</p>
37. </li>
38. <!--{/loop}-->
39. </ul>
40. </div>
复制代码 |