# 全局標簽
> 全局標簽可以在任何一個頁面使用并有效。根據常見用途和位置列出全局標簽。
| 用途 | 標簽 |
| --- | --- |
| 站點名稱 | {$site\[site\_name\]} |
| 站點地址 | {$site\[site\_url\]} |
| 標題 | {$seo\_title} |
| 關鍵字 | {$keywords} |
| 描述 | {$description} |
| 網站版權信息 | {$site\[site\_copyright\]} |
| 網站備案號 | {$site\[site\_filing\]} |
| 統計代碼 | {$site\[site\_code\]} |
| 包含文件 | {m:include "模塊名","文件名"} 例如:{m:include "index","header"} |
| Css/Js/Images的靜態路徑 | {STATIC\_URL} ,指的路徑為:/common/static/ |
| 判斷會員是否登錄 | {if $userid==0}會員未登錄{else}你好:{$username}{/if} |
| 如果會員登錄顯示ID為2的欄目 | {if $userid==0}未登錄{else}{get\_category(2, 'catname')}{/if} |
| LOGO | |
| 版權 | {$site\[site\_copyright\]} |
| 調用欄目ID為4的單頁內容 | {page\_content(4, 200)} |
| 判斷文章屬性 | {if flag=5}{else}{/if} |
| 獲取欄目ID為3的欄目名稱 | {get\_catname(3)} |
| 獲取欄目ID為3的欄目鏈接 | {get\_category(3, 'pclink')} |
| 獲取欄目ID為1的單頁內容(300指的是限制字數) | {page\_content(1, 300)} |
| 如果在循環中獲取欄目名稱則 | {get\_catname($v\['catid'\])} |
| 循環中想獲取用戶頭像的話 | |
| 判斷是否首頁 | {if $_SERVER["REQUEST_URI"]=='/'}我是首頁{else}我非首頁{/if} |
| 全局方法來獲取用戶頭像 | {get\_memberavatar($userid)} |
| ...... | ...... |
header里面pc版本切換到手機版
~~~
<script type="text/javascript">
function browserRedirect() {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
{if $catid == '' and $id == ''}
window.location.href = "{$site[site_url]}mobile/index/init";
{elseif $id == '' and $catid != ''}
window.location.href = "{$site[site_url]}mobile/index/lists/catid/{$catid}.html";
{else}
window.location.href = "{$site[site_url]}mobile/index/show/catid/{$catid}/id/{$id}.html";
{/if}
}
}
browserRedirect()
</script>
~~~