# 全局标签
> 全局标签可以在任何一个页面使用并有效。根据常见用途和位置列出全局标签。
| 用途 | 标签 |
| --- | --- |
| 站点名称 | {$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>
~~~