# 内容页标签
> 常用的和不常用的首页标签都会列出,根据用途会有所缺少,欢迎补充。
| 用途 | 标签 |
| --- | --- |
| **短标签(为了排版需要,长短标签分开展示)** |
| 当前位置 | {get\_location($catid)} |
| 父级id | {$category[parentid]} |
| 标题 | {$title} |
| 来源: | {$copyfrom} |
| 发布日期 | {date('Y-m-d H:i:s',$inputtime)} |
| 更新日期 | {date('Y-m-d H:i:s',$updatetime)} |
| 作者昵称 | {$nickname} |
| 浏览次数 | {$click} |
| 缩略图 | |
| 内容 | {$content} |
| 摘要 | {$description} |
| 上一篇 | {$pre} |
| 下一篇 | {$next} |
| 评论计数 | {count($data)} |
| 打印 | 打印 |
| 判断内容是否为会员发布 | {if $system}管理员发布{else}会员发布{/if} |
| 如果为会员发布,调用会员头像及主页地址 | {if !$system} $userid))}" target="\_blank"> {/if} |
### :-: **TAG标签**
~~~
{m:centent_tag modelid="$modelid" id="$id" limit="10"}
{if empty($data)}无标签{/if}
{loop $data $v}
<a href="{U('search/index/tag',array('id'=>$v['id']))}" target="_blank">{$v[tag]}</a>
{/loop}
~~~
### :-: **评论表单**
~~~
<form action="{U('comment/index/init')}" method="post" onsubmit="return check_comm(this)">
<input type="hidden" name="modelid" value="{$modelid}">
<input type="hidden" name="catid" value="{$catid}">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="title" value="{$title}">
<input type="hidden" name="url" value="{$url}">
<textarea class="textarea" id="content" name="content" placeholder="我来说两句~"></textarea>
<p><input type="submit" class="sub_btn" name="dosubmit" value="提交"><span class="emotion">表情</span></p>
</form>
~~~
### :-: **评论调用**
~~~
<div class="comment_list">
{m:comment_list modelid="$modelid" catid="$catid" id="$id" limit="20"}
<div class="comment_list_top">共{count($data)}条评论</div>
<div class="comment_list_body">
<ul>
{loop $data $v}
<li>
<a class="user_pic" href="{U('member/myhome/init', array('userid'=>$v['userid']))}" target="blank"><img src="{if !empty($v['userpic'])}{$v[userpic]}{else}{STATIC_URL}images/default.gif{/if}" height="35" width="35"></a>
<div class="comm_right">
<a class="user_name" href="{U('member/myhome/init', array('userid'=>$v['userid']))}" target="blank">{$v[username]}</a>
<p>{nl2br($v['content'])}</p>
<p><span class="comm_time">{date('Y-m-d H:i:s',$v['inputtime'])}</span> <a href="javascript:toreply('{$v[id]}');" class="comm_a">回复</a></p>
<div id="rep_{$v[id]}" class="none">
<form action="{U('comment/index/init')}" method="post" onsubmit="return check_rep(this)">
<input type="hidden" name="modelid" value="{$modelid}">
<input type="hidden" name="catid" value="{$catid}">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="title" value="{$title}">
<input type="hidden" name="url" value="{$url}">
<input type="hidden" name="reply" value="{$v[id]}">
<input type="hidden" name="reply_to" value="{$v[username]}">
<textarea name="content" class="textarea textarea2" placeholder="我来说两句~"></textarea>
<input type="submit" class="sub_btn static" name="dosubmit" value="提交">
</form>
</div>
</div>
</li>
{/loop}
{if empty($data)}<li>这篇文章还没有收到评论,赶紧来抢沙发吧~</li>{/if}
</ul>
</div>
</div>
~~~
### :-: **最新评论标签**
~~~
{m:comment_newest limit="10"}
<ul>
{loop $data $v}
<li>
<span class="comment_article"><a href="{$v[url]}" title="{$v[title]}">{$v[title]}</a></span>
<span class="comment_comment">{if $v['userid']}{$v[username]}{else}网友评论{/if}:{$v[content]}</span>
</li>
{/loop}
</ul>
~~~
### :-: **相关文章**
~~~
{m:relation field="title,url,thumb" modelid="$modelid" id="$id" limit="4"}
{loop $data $k=>$v}
<li{if $k==3} class="m_r0"{/if}><a href="{$v[url]}"><img src="{if !empty($v['thumb'])}{$v[thumb]}{else}{STATIC_URL}images/nopic.jpg{/if}" alt="{$v[title]}"><em>{str_cut($v['title'], 36)}</em></a></li>
{/loop}
~~~
### :-: **点击排行**
~~~
<h2 class="ind_bt">点击排行</h2>
{m:hits field="title,url,thumb" modelid="$modelid" limit="5"}
{loop $data $v}
<div class="img_text"><a href="{$v[url]}"><img src="{if !empty($v['thumb'])}{$v[thumb]}{else}{STATIC_URL}images/nopic.jpg{/if}" alt="{$v[title]}"></a><a href="{$v[url]}">{str_cut($v['title'], 81)}</a></div>
{/loop}
~~~
### :-: **随机文章**
~~~
<h2 class="ind_bt mt_20 pl_10">随机新闻</h2>
{m:lists field="title,url,thumb" modelid="$modelid" order="RAND()" limit="5"}
{loop $data $v}
<div class="img_text"><a href="{$v[url]}"><img src="{if !empty($v['thumb'])}{$v[thumb]}{else}{STATIC_URL}images/nopic.jpg{/if}" alt="{$v[title]}"></a><a href="{$v[url]}">{str_cut($v['title'], 81)}</a></div>
{/loop}
~~~
### :-: **评论排行**
~~~
<h2 class="ind_bt mt_20 pl_10">评论排行榜</h2>
<div class="l_list">
<ul>
{m:comment_ranking modelid="1" limit="10"}
{loop $data $v}
<li><a href="{$v[url]}" title="{$v[title]}">{str_cut($v['title'], 63)}</a></li>
{/loop}
</ul>
</div>
~~~
### :-: **收藏代码(记得别忘了id="favorite")**
~~~
<span id="favorite"><a href="javascript:;" onclick="add_favorite('{$title}');">收藏</a></span>
~~~
~~~
<script type="text/javascript">
function add_favorite(title) {
$.ajax({
type: 'POST',
url: '{U("api/index/favorite")}',
data: 'title='+title+'&url='+location.href,
dataType: "json",
success: function (msg) {
if(msg.status == 1){
$("#favorite").html('收藏成功');
}else{
alert('请先登录!');
}
}
});
}
</script>
~~~
### :-: **多图片上传调用(图集)**
~~~
{php $pictures = string2array($pictures);}
<ul>
{loop $pictures $v}
<li><a href="javascript:;"><img src="{$v[url]}" alt="{$v[alt]}" title="{$v[alt]}"></a></li>
{/loop}
<ul>
~~~
### :-: **相关内容标签(有相同tag标签的内容视为相关内容)**
~~~
{m:relation field="title,url,thumb" modelid="$modelid" id="$id" limit="5"}
{loop $data $v}
<a href="{$v[url]}" target="_blank">{$v[title]}</a>
{/loop}
~~~
~~~
可能存在的属性:
属性名------解释说明
field ------获取字段名称,例如: field="title,thumb,catid,url" 全部字段请在后台-模型管理-字段管理中查看
modelid------模型id,必填
id------当前文章id,必填
limit ------限制条数,例如: limit="10" 默认值为20,此属性可选
~~~
### :-: **文章归档标签**
~~~
{m:content_archives modelid="1" type="2" limit="10"}
<ul>
{loop $data $v}
<li><a href="{U('search/index/archives',array('pubtime'=>$v['inputtime']))}" target="_blank">{$v[pubtime]}({$v[total]})</a></li>
{/loop}
</ul>
~~~