Home » 编程及脚本语言

SuperSite资讯模块调用说明

18 十一月 2009 1,612 views One Comment

现在举例说明

<!--{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、资讯根分类列表
<!--block name=”category” parameter=”type/news/isroot/1/ischannel/2/order/c.displayorder/limit/0,100/cachetime/10800/cachename/category/tpl/data”-->
<!--loop $_SBLOCK['category'] $value-->
 <li><a href="”$value[url]”" target="”_self”">$value[name]</a></li>
<!--/loop-->

2、资讯最新主题列表(以等级2为例)
<!--block name=”spacenews” parameter=”grade/2/order/i.dateline DESC/limit/0,10/subjectlen/30/subjectdot/1/cachetime/18000/cachename/recommend2news/tpl/data”-->
<!--loop $_SBLOCK['recommend2news'] $value-->
 <li><a title="”$value[subjectall]“" href="”$value[url]”">$value[subject]</a></li>
<!--/loop-->

—–说明:grade/2/ recommend2news表示等级2,余类推。

3、图文资讯幻灯片
<!--block name=”spacenews” parameter=”grade/4/haveattach/1/showattach/1/order/i.dateline DESC/limit/0,4/cachetime/11930/cachename/picnews/tpl/data”-->
<div><!--eval $picarr=$linkarr=$textarr=array();-->
<!--loop $_SBLOCK['picnews'] $ikey $value-->
<!--eval $picarr[] = ‘”‘.$value[a_filepath].’”‘;-->
<!--eval $linkarr[] = ‘”‘.$value[url].’”‘;-->
<!--eval $textarr[] = ‘”‘.$value[subject].’”‘;-->
<!--/loop-->
<!--eval $pics = implode(’,', $picarr);-->
<!--eval $links = implode(’,', $linkarr);-->
<!--eval $texts = implode(’,', $textarr);-->
<script type="”text/javascript”">// <![CDATA[
            <!–             var focus_width=208;             var focus_height=208;             var text_height=20;                         var xsImgs = new Array({$pics});             var xsImgLinks = new Array({$links});             var xsImgTexts = new Array({$texts});             var xsImgSize = new Array(focus_width, focus_height);             //–>

4、头条新闻列表(内容截取、略图):
<!--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”--><!--loop $_SBLOCK['headnews'] $value--><!--if !empty($value['a_thumbpath'])-->
<a href="”$value[url]“"><img src="”$value[a_thumbpath]”" alt="”&quot;" /></a>
<!--/if-->
<strong><a href="”$value[url]“">$value[subject]</a></strong> $value[message]
<!--/loop-->

5、站内最新资讯列表
<!--block name=”spacenews” parameter=”order/i.dateline DESC/limit/0,15/showspacename/1/subjectlen/40/subjectdot/1/cachetime/1800/cachename/newgradenews/tpl/data”--><!--loop $_SBLOCK['newgradenews'] $value-->
 <li><cite>#date(”m-d”, $value["dateline"])# </cite><a href="”$value[url]“">$value[subject]</a></li>
<!--/loop-->

6、最热资讯TAG列表
<!--block name=”tag” parameter=”order/spacenewsnum DESC/limit/0,20/cachetime/18000/cachename/hottag/tpl/data”--><!--loop $_SBLOCK['hottag'] $value-->
<a href="”$value[url]“">$value[tagname]<em>($value[spacenewsnum])</em></a>
 <!--/loop-->

7、站内热门资讯列表(一周)–以浏览数
<!--block name=”spacenews” parameter=”dateline/604800/order/i.viewnum DESC/limit/0,10/cachetime/15400/subjectlen/40/subjectdot/1/cachename/hotnews1/tpl/data”--><!--loop $_SBLOCK['hotnews1'] $value-->
 <li><cite>#date(”m-d”, $value["dateline"])# </cite><a href="”$value[url]“">$value[subject]</a>($value[viewnum])</li>
<!--/loop-->

8、站内热门资讯列表(一月)–以浏览数
<!--block name=”spacenews” parameter=”dateline/2592000/order/i.viewnum DESC/limit/0,10/cachetime/17200/subjectlen/40/subjectdot/1/cachename/hotnews2/tpl/data”--><!--loop $_SBLOCK['hotnews2'] $value-->
 <li><cite>#date(”m-d”, $value["dateline"])# </cite><a href="”$value[url]“">$value[subject]</a>($value[viewnum])</li>
<!--/loop-->

9、站内热门资讯列表(开站以来)–以浏览数
<!--block name=”spacenews” parameter=”order/i.viewnum DESC/limit/0,10/cachetime/17400/subjectlen/40/subjectdot/1/cachename/hotnews3/tpl/data”--><!--loop $_SBLOCK['hotnews3'] $value-->
 <li><cite>#date(”m-d”, $value["dateline"])# </cite><a href="”$value[url]“">$value[subject]</a>($value[viewnum])</li>
<!--/loop-->

10、图片资讯(略图、标题)
<!--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”--><!--loop $_SBLOCK['picnews'] $value-->
 <li>
<div><a href="”$value[url]“"><img src="”$value[a_thumbpath]”" alt="”$value[subjectall]”" /></a></div>
<a href="”$value[url]“">$value[subject]</a></li>
<!--/loop-->

11、站内热门资讯列表(一周)—按评论数
<!--block name=”spacenews” parameter=”lastpost/604800/order/i.replynum DESC/limit/0,10/cachetime/15400/subjectlen/40/subjectdot/1/cachename/replyhot/tpl/data”--><!--loop $_SBLOCK['replyhot'] $value-->
<a href="”$value[url]“">$value[subject]</a> #date(”m-d”, $value["lastpost"])# / <a href="”$value[url]“">评论($value[replynum])</a>
 <!--/loop-->

12、最新发表(含评论)资讯列表
<!--block name=”spacenews” parameter=”order/i.lastpost DESC/limit/0,20/cachetime/1500/cachename/newnews/tpl/data”--><!--loop $_SBLOCK['newnews'] $value-->
<a href="”$value[url]“">$value[subject]</a> #date(”m-d”, $value["lastpost"])# / <a href="”$value[url]“">评论($value[replynum])</a>
 <!--/loop-->

13、月度关注热点—按评论数
<!--block name=”spacenews” parameter=”lastpost/2592000/order/i.replynum DESC/limit/0,50/cachetime/35400/subjectlen/40/subjectdot/1/cachename/replyhot/tpl/data”--><!--loop $_SBLOCK['replyhot'] $value-->
<a href="”$value[url]“">$value[subject]</a> #date(”m-d”, $value["lastpost"])# / <a href="”$value[url]“">评论($value[replynum])</a>
 <!--/loop-->

14、各分类最新资讯列表
<!--loop $_SBLOCK['category'] $ckey $cat--><!--eval $ctime=1800+30*$ckey;--><!--block name=”spacenews” parameter=”catid/$cat[subcatid]/order/i.dateline DESC/limit/0,10/cachetime/$ctime/subjectlen/40/subjectdot/1/cachename/newslist/tpl/data”-->
<div>
<h3><strong><a href="”#action/category/catid/$cat[catid]#”" target="”_self”">$cat[name]</a></strong> <a href="”#action/category/catid/$cat[catid]#”" target="”_self”">更多</a></h3>
<ul><!--loop $_SBLOCK['newslist'] $value-->
 <li><cite>#date(”m-d”, $value["dateline"])# </cite><a href="”$value[url]“">$value[subject]</a></li>
<!--/loop--></ul>
</div>
<!--/loop-->

15、当前分类月度关注热点—-按浏览数
<!--block name=”spacenews” parameter=”catid/$thecat[subcatid]/dateline/2592000/order/i.viewnum DESC/limit/0,10/cachetime/28800/cachename/hotnews/tpl/data”--><!--loop $_SBLOCK['hotnews'] $value-->
<a href="”$value[url]“">$value[subject]</a> <a href="”#uid/$value[uid]/action/space#”">$value[username]</a> / <a href="”$value[url]“">点击($value[viewnum])</a>
 <!--/loop-->

16、当前分类最新资讯
<!--block name=”spacenews” parameter=”catid/$thecat[subcatid]/order/i.dateline DESC/limit/0,10/cachetime/7280/cachename/newnews/tpl/data”--><!--loop $_SBLOCK['newnews'] $value-->
<a href="”$value[url]“">$value[subject]</a>
 <!--/loop-->

17、当前资讯相关文章–&gt;
<!--if !empty($news[relativeitemids])--><!--block name=”spacenews” parameter=”itemid/$news[relativeitemids]/order/i.dateline DESC/limit/0,20/cachetime/17680/cachename/relativeitem/tpl/data”--><!--loop $_SBLOCK['relativeitem'] $ikey $value-->
<a title="”$value[subjectall]“" href="”$value[url]”" target="”_blank”">$value[subject]</a>
 <!--/loop--><!--/if-->

18、资讯浏览页: 标题:$news[subject] 作者:$news[newsauthor] 时间:#date(’Y-n-d H:i’, $news["dateline"])# 来源: $news[newsfrom] 内容:$news[message] 图片附件:
<!--loop $news['attacharr'] $attach-->
<a href="”$attach[url]”" target="”_blank”"><img src="”$attach[thumbpath]”" alt="”$attach[subject]”" /></a> $attach[subject]
<!--/loop-->
TAG:
<!--if !empty($relativetagarr)-->
<strong>TAG:</strong>
 <!--loop $relativetagarr $value--><!--eval $svalue = rawurlencode($value);-->
<a href="”#action/tag/tagname/$svalue#”" target="”_blank”">$value</a>
 <!--/loop--><!--/if-->
分页:$multipage 19、查看最新评论:
<!--if !empty($commentlist)-->
<div id="”commentlist”">
<h3><a href="”#action/viewcomment/itemid/$news[itemid]#”" target="”_self”">查看全部评论($news[replynum])</a> <strong>最新评论</strong></h3>
<ul><!--loop $commentlist $value-->
 <li>
<h4><a href="”#action/viewcomment/itemid/$value[itemid]/cid/$value[cid]/op">删除</a> <!--if empty($value[authorid])-->$value[author] <!--else--><a href="”{B_URL}/viewpro.php?uid=$value[authorid]”" target="”_blank”">$value[author]</a> <!--/if--><span>(#date(”Y-n-d H:i:s”, $value["dateline"])#, 评 <strong>$value[rates]</strong> 分)</span></h4>
$value[message]</li>
<!--/loop--></ul>
</div>
<!--/if-->

20、内容页多媒体及图片链接作用js: <script type="”text/javascript”">// <![CDATA[
<!–     addMediaAction(’articlebody’);     addImgLink(”articlebody”); //–>
// ]]></script>

// ]]></script>
<script src=””{S_URL}/include/js/slide.js”” type=””text/javascript””></script></div>

21、资讯当前类别封面图片及简介:
<!--if $thecat['thumb'] || $thecat['note']-->
<div><!--if $thecat['thumb']--></div>
<div><img src="”{A_URL}/$thecat[thumb]”" alt="”&quot;" /></div>
<!--/if-->
<!--if $thecat['note']-->

$thecat[note]

<!–/if–>

<!–/if–>

22、当前类别资讯子分类
<!--block name=”category” parameter=”upid/$thecat[catid]/ischannel/2/order/c.displayorder/limit/0,100/cachetime/10900/cachename/subarr/tpl/data”-->
<!--if $_SBLOCK['subarr']-->
<!--loop $_SBLOCK['subarr'] $value-->
 <li><a href="”$value[url]”" target="”_self”">$value[name]</a></li>
<!--/loop-->
<!--/if-->

23、当前类别资讯子分类列表
<!--block name=”category” parameter=”upid/$thecat[catid]/ischannel/1/showattach/1/order/c.displayorder/limit/0,100/cachetime/16400/cachename/channel/tpl/data”-->
<!--if $_SBLOCK['channel']-->
<!--loop $_SBLOCK['channel'] $value-->
 <li><a href="”#action/category/catid/$value[catid]#”" target="”_self”"><img src="”$value[thumb]”" alt="”&quot;" /></a><a href="”#action/category/catid/$value[catid]#”" target="”_self”">$value[name]</a></li>
<!--/loop-->
<!--/if-->

24、当前类别根分类最新资讯列表
<!--if $_SGET['page']<2 || empty($_SGET['mode'])-->
<!--block name=”spacenews” parameter=”perpage/40/catid/$thecat[subcatid]/order/i.dateline DESC/cachename/newlist/tpl/data”-->
<!--if $_SBLOCK['newlist']-->
<div>
<h3><strong>$thecat[name]</strong></h3>
<ul><!--loop $_SBLOCK['newlist'] $value--></ul>
</div>
 <li><cite>#date(”m-d”, $value["dateline"])# </cite><a href="”$value[url]“">$value[subject]</a></li>
<!--/loop-->
<div><!--if $_SBLOCK[newlist_multipage]-->
$_SBLOCK[newlist_multipage]
<!--else--></div>
<table border="0" summary="”&quot;">
<tbody>
<tr>
<td>当前只有一页</td>
</tr>
</tbody></table>
<!--/if-->
<!--/if-->

25、当前类别关联论坛最新帖子:
<!--if !empty($thecat['bbsmodel'])-->
<!--if $_SGET['page']<2 || !empty($_SGET['mode'])-->
<!--eval $_SGET['mode']=’bbs’;-->
<!--block name=”bbsthread” parameter=”perpage/40/$thecat[blockparameter]/cachename/bbsthreadlist/tpl/data”-->
<!--if $_SBLOCK['bbsthreadlist']-->
<!--loop $_SBLOCK['bbsthreadlist'] $value-->
 <li><cite>#date(”m-d”, $value["dateline"])# </cite><a href="”$value[url]“">$value[subject]</a></li>
<!--/loop-->
<div><!--if $_SBLOCK[bbsthreadlist_multipage]-->
$_SBLOCK[bbsthreadlist_multipage]
<!--else--></div>
<table border="0" summary="”&quot;">
<tbody>
<tr>
<td>当前只有一页</td>
</tr>
</tbody></table>
<!--/if-->

26、当前类别子分类资讯列表
<!--if $_SGET['page']<2-->
<!--loop $_SBLOCK['subarr'] $ckey $cat-->
<!--eval $ctime=1800+30*$ckey;-->
<!--block name=”spacenews” parameter=”catid/$cat[subcatid]/order/i.dateline DESC/limit/0,10/cachetime/$ctime/cachename/subnewlist/tpl/data”-->
<!--if $_SBLOCK['subnewlist']-->
<div>
<h3><strong><a href="”#action/category/catid/$cat[catid]#”" target="”_self”">$cat[name]</a></strong>
<a href="”#action/category/catid/$cat[catid]#”" target="”_self”">更多</a></h3>
<ul><!--loop $_SBLOCK['subnewlist'] $value--></ul>
</div>
 <li><cite>#date(”m-d”, $value["dateline"])# </cite><a href="”$value[url]“">$value[subject]</a></li>
<!--/loop-->

<!–/if–>
<!–/if–>
<!–/if–>

<!–/if–>
<!–/loop–>
<!–/if–>

27、当前资讯评论:
<div id="”commentlist”">
<h3 style="”text-align:"><strong>评论 &lt;&lt; <a href="”#action/viewnews/itemid/$item[itemid]#”">$item[subject]</a> &gt;&gt;</strong></h3>
<h5 style="”margin:">查看数: $item[viewnum] /
评论数: $item[replynum] /
好评分: $item[goodrate] /
差评分: $item[badrate]</h5>
<ul><!--loop $iarr $value--></ul>
</div>
 <li>
<h4><a href="”#action/viewcomment/itemid/$value[itemid]/cid/$value[cid]/op">删除</a>
<!--if empty($value[authorid])-->$value[author]<!--else--><a href="”{B_URL}/viewpro.php?uid=$value[authorid]”" target="”_blank”">$value[author]</a><!--/if-->
<span>(第{$value[num]}楼, #date(”Y-n-d H:i:s”, $value["dateline"])#, 评 <strong>$value[rates]</strong> 分)</span></h4>
$value[message]</li>
<!--/loop-->

One Comment »

  • aghostcn (author) said:

    模板里打印一个数组

Leave your response!

You must be logged in to post a comment.