当前位置:首页 > 未命名

zblog模板只(单独)调取置顶文章到首页,限制(指定)N条数

8976988821个月前 (01-10)未命名4

在修改zblog模板时,可能牵涉到了在首页某区仅调取置顶文章,并且要限制最大调取数量!

1、zblogPHP调取全部置顶文章:

{foreach $articles as $article}{if $article.IsTop}{template:blog-istop}{/if}{/foreach}

注:这是在首页调取全部置顶文章的默认代码,其中{template:blog-istop}是置顶文章模板,注意不要与列表置顶文章模板重复了,除非你需要一模一样。

2、zblogPHP调取指定数量的置顶文章代码

{$topArray = GetList(2, null, null, null, null, null, array("only_ontop"  => true));}{foreach $topArray as $article}      {template:post-istop}{/foreach}

其中2就是调取最新2条最新的置顶文章,注意是最新发布的置顶文章!

扫描二维码推送至手机访问。

版权声明:本文由米表程序发布,如需转载请注明出处。

本文链接:https://www.9909999.xyz/post/285.html

分享给朋友: