🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## tagarclist根据标签获取文章内容列表 用于**根据标签获取文章列表** <blockquote class="danger"><p>HkCms_2.2.4.230206版本起</p></blockquote> ## 参数 | 参数名称 | 可选值 | 默认值 | 是否必填 | 说明 | | --- | --- | --- | --- | --- | | tid| 标签ID或0 | - | - | 0-表示获取所有 | | arcid| 文章ID | - | tid与arcid选一个 | 获取指定文章包含的标签 | | model | 模型ID | - | acrid填写时,该值不能为空 | 指定标签属于的模型 | | catid | 栏目ID |- |- | 指定标签属于的栏目| | order | - | views desc(点击量降序) | - |排序| | num|-| -| - |限制结果数量| | where|- |-| -| sql筛选条件 | | page| 1| -| - | 开启分页,配合 {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} ~~~