## tagArticles标签 > 5.0.180123新增 | 标签名 | 作用 | 包含属性 | | --- | --- | --- | | tagArticles | 获取标签文章列表 | field,where,limit,order,page,relation,pageVarName,categoryIds,item | 标签属性: | 标签属性名 | 含义 | | --- | --- | | where | 查询条件变量, 支持数组和字符串,如`$where` | | limit | 最多查出文章数,如果分页开启,此设置无效 | | order | 文章排序方式 | | page | 分页参数,如果设置分页参数会自动分页 | | relation | 关联查询,支持`categories`和`user`,多个以英文逗号分隔 | | pageVarName | 分页后生成的分页变量名,只有设置分页参数时才有效 | | tagId | 文章标签id| ## 一个标签的最新文章列表,不分页 ``` <php> $tag_id=1; </php> <portal:tagArticles limit="5" order="post.published_time DESC" tagId="$tag_id"> <dl class="dl-horizontal"> <dt> <a class="img-wraper" href="{:url('portal/Article/index',array('id'=>$vo.id,'cid'=>$vo.category_id))}"> <if condition="empty($vo.more.thumbnail)"> <img src="__TMPL__/public/assets/images/default_tupian4.png" class="img-responsive" alt="{$vo.post_title}"/> <else/> <img src="{:cmf_get_image_url($vo.more.thumbnail)}" class="img-responsive" alt="{$vo.post_title}"/> </if> </a> </dt> <dd> <a href="{:url('portal/Article/index',array('id'=>$vo['id'],'cid'=>$vo.category_id))}">{$vo.post_title}</a> </dd> </dl> </portal:tagArticles> ``` ## 一个标签的文章列表,分页 ```html <div> <php> $where=[ 'post.create_time'=>['egt',0] ]; </php> <portal:tagArticles item="vo" where="$where" order="post.create_time DESC" page="10" relation="categories" tagId="1" returnVarName="tag_articles_data"> <div class="list-boxes"> <h2><a href="{:cmf_url('portal/Article/index',array('id'=>$vo['id'],'cid'=>$category['id']))}">{$vo.post_title}</a> </h2> <p>{$vo.post_excerpt}</p> <div> <div class="pull-left"> <div class="list-actions"> <a href="javascript:;"><i class="fa fa-eye"></i><span>{$vo.post_hits}</span></a> <a href="{:url('portal/Article/doLike',array('id'=>$vo['id']))}" class="js-count-btn"><i class="fa fa-thumbs-up"></i><span class="count">{$vo.post_like}</span></a> <a href="{:url('user/Favorite/add',array('id'=>$vo['id']))}" class="js-favorite-btn" data-title="{$vo.post_title}" data-url="{:cmf_url('portal/Article/index',array('id'=>$vo['id'],'cid'=>$category['id']))}" > <i class="fa fa-star-o"></i> </a> </div> </div> <a class="btn btn-warning btn-sm pull-right" href="{:cmf_url('portal/Article/index',array('id'=>$vo['id'],'cid'=>$category['id']))}">查看更多</a> </div> </div> </portal:tagArticles> </div> <ul class="pagination"> <page/> </ul> ```