Hkcms tagarclist根据标签获取文章内容列表

用于根据标签获取文章列表

HkCms_2.2.4.230206版本起

参数

参数名称可选值默认值是否必填说明
tid标签ID或0--0-表示获取所有
arcid文章ID-tid与arcid选一个获取指定文章包含的标签
model模型ID-acrid填写时,该值不能为空指定标签属于的模型
catid栏目ID--指定标签属于的栏目
order-views desc(点击量降序)-排序
num---限制结果数量
where---sql筛选条件
page1--开启分页,配合 {hkcms:contentpage /} 分页标签
id-$item-指定循环里的变量名,例如id='obj',模板调用如:{$item.title} 变成 {$obj.title}
empty--为空的时候输出提示,支持传入html
cache-3600秒-缓存时间,默认3600秒
currentstyle-active-css class 类名,用于定义当前选择状态样式

简单示例.

在标签页tags_list页面,获取文章列表

// 在标签列表页有$Tags变量,即当前标签,这里代码意思是:获取当前标签下的文章。里面的字段是文章的字段{hkcms:tagarclist tid="$Tags['id']" num="6" page="1"}

        <a href="{$item.url}" title="{$item.title}"><img src="{:cdn_url($item.thumb)}" style="object-fit: cover;" alt="{$item.title}"></a>

            <h5><a href="{$item.url}" title="{$item.title}">{$item.title}</a></h5>
            <h6>{hkcms:date name="$item['publish_time']" /}</h6>
            <p class="card-text"><a href="{$item.url}">{$item.description}</a></p></div>{/hkcms:tagarclist}配合分页{hkcms:contentpage item="home,pre,pageno,next,last,info" mobile_item="pre,pageno,next" pre="&laquo;" next="&raquo;" /}

在其他位置获取,例如你的标签ID是10,那么获取文章里面有10的标签列表

// 在标签列表页有$Tags变量,即当前标签,这里代码意思是:获取当前标签下的文章。里面的字段是文章的字段{hkcms:tagarclist tid="10" num="6" }

        <a href="{$item.url}" title="{$item.title}"><img src="{:cdn_url($item.thumb)}" style="object-fit: cover;" alt="{$item.title}"></a>

            <h5><a href="{$item.url}" title="{$item.title}">{$item.title}</a></h5>
            <h6>{hkcms:date name="$item['publish_time']" /}</h6>
            <p class="card-text"><a href="{$item.url}">{$item.description}</a></p></div>{/hkcms:tagarclist}



本文关键词:

联系我们

在线咨询:点击这里给我发消息

邮件:w420220301@qq.com