# 內容頁標簽
> 常用的和不常用的首頁標簽都會列出,根據用途會有所缺少,歡迎補充。
| 用途 | 標簽 |
| --- | --- |
| **短標簽(為了排版需要,長短標簽分開展示)** |
| 當前位置 | {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>
~~~