首页 未命名内容详情

zblog php 调用指定 tag 文章列表的方法

2026-01-10 1 897698882
zblog php 调用指定 tag 文章列表的方法

站点名称:zblog php 调用指定 tag 文章列表的方法

所属分类:未命名

官方网址:

SEO查询: 爱站网 站长工具

进入网站

站点介绍

我们在做 zblog 主题中常常需要调用指定 tag 的文章列表,这样可以让网站内容的类别多样,展示更加丰富。

用下面的调用代码就可以实现:

{$array=Getlist(9,null,null,null,array($zbp->GetTagByID(242),$zbp->GetTagByAliasOrName('phptheme')));} {foreach $array as $article} {template:thumbnail} <div class="theme-item">  <div class="theme-item-box">  <div class="theme-bg" style="background:url({$temp}) no-repeat center top; background-size:cover;"> <a href="{$article.Url}" title="{$article.Title}" target="_blank"></a>  </div>  <div class="theme-title">  <h3><a href="{$article.Url}" class="overdot work-title" target="_blank" title="{$article.Title}">{$article.Title}</a></h3>   <div class="theme-description">{$article.Intro}</div>    <div class="theme-meta"> <div class="theme-meta-price">    <div class="download-meta-price-details">    <a href="{$article.Category.Url}" rel="bookmark"><span class="edd_price">{$article.Category.Name}</span></a> </div>    </div>    <div class="theme-meta-name"> <span class="author vcard"><i class="fa fa-eye"></i>{$article.ViewNums}</span>    </div> </div> </div> </div> </div> {/foreach}

代码中数字 9 是指调用的文章数量,242 是 tag 标签的 id,phpheme 是标签的别名。

以上内容可以根据自己的需求进行调整。