在做zblogphp网站的时候,常常需要调用置顶文章列表,我们可以通过下面代码来实现
具体调用代码如下:
{$topArray = GetList(10, null, null, null, null, null, array("only_ontop" => true));} <ul> {foreach $topArray as $top} <li><a href="{$top.Url}" title="{$top.Title}" target="_blank">{$top.Title}</a></li> {/foreach} </ul>
其中GetList后面括号里的第一个 10 是要调用的置顶文章数量。
GetList 函数语法:
Array GetList($count = 10, $cate = null, $auth = null, $date = null, $tags = null, $search = null, $option = null)
调用参数
参数类型 | 参数 | 默认值 | 描述 |
---|---|---|---|
int | $count | 10 | 提取条数 |
int | $cate | null | 分类ID |
int | $auth | null | 用户ID |
string | $date | null | 时间 |
mixed | $tags | null | 标签ID、名称或者标签数组 |
string | $search | null | 搜索关键字 |
array | $option | null | 附加选项 |
参数说明
tags
tags参数允许使用三种类型:int,string,array
参数类型 | 示例 |
---|---|
int | 2 |
string | “abc” |
array | Array( [0] ⇒ Tag Object0, [1] ⇒ Tag Object1 ) |