header 和footer模板部分必要代码解析
===================Discuz! X1.5版本======================template\default\common\head_common.htm文件中:
<title><!--{if !empty($navtitle)}-->$navtitle - <!--{/if}--><!--{if empty($nobbname)}--> $_G['setting']['bbname'] - <!--{/if}--> Powered by Discuz!</title><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
<meta name="keywords" content="{if !empty($metakeywords)}{echo htmlspecialchars($metakeywords)}{/if}" />
<meta name="description" content="{if !empty($metadescription)}{echo htmlspecialchars($metadescription)} {/if},$_G['setting']['bbname']" />
title部分和keywords、discription。在后台中的 搜索引擎优化设置
$_G['setting']['seohead'] 对应后台的其他头部信息设置
这代码是对样式文件的加载<!--{csstemplate}-->
<script type="text/javascript">var STYLEID = '{STYLEID}', STATICURL = '{STATICURL}', IMGDIR = '{IMGDIR}', VERHASH = '{VERHASH}', charset = '{CHARSET}', discuz_uid = '$_G', cookiepre = '{$_G}', cookiedomain = '{$_G}', cookiepath = '{$_G}', showusercard = '{$_G}', attackevasive = '{$_G}', disallowfloat = '{$_G}', creditnotice = '<!--{if $_G['setting']['creditnotice']}-->$_G['setting']['creditnames']<!--{/if}-->', defaultstyle = '$_G', REPORTURL = '$_G', SITEURL = '$_G';</script><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
初始化必要的js变量<script type="text/javascript" src="{$_G}common.js?{VERHASH}"></script>加载common.js
template\default\common\header.htm
从第1行至20行
通过判断加载相应的js和css文件
template\default\common\header_diy.htm 用于显示diy时候基本页面
template\default\common\footer.htm<!--{if $_GET['diy'] == 'yes' && ($_G == 'topic' || $_G) && (empty($do) || $do != 'index') && !empty($_G['style']['tplfile'])}-->
<script type="text/javascript" src="{$_G}common_diy.js?{VERHASH}"></script>
<script type="text/javascript" src="{$_G}portal_diy.js?{VERHASH}"></script>
<!--{/if}-->
<!--{if $_GET['diy'] == 'yes' && $space['self'] && $_G == 'space' && $do == 'index'}-->
<script type="text/javascript" src="{$_G}common_diy.js?{VERHASH}"></script>
<script type="text/javascript" src="{$_G}space_diy.js?{VERHASH}"></script>
<!--{/if}-->
<!--{if $_G['member']['newprompt'] && (empty($_G['cookie']['promptstate_'.$_G]) || $_G['cookie']['promptstate_'.$_G] != $_G['member']['newprompt']) && $_G['gp_do'] != 'notice'}-->
<script type="text/javascript">noticeTitle();</script>
<!--{/if}-->
<!--{eval output();}-->
这部分代码是diy时候必要的,如果缺少将不能diy
template\default\common\footer_ajax.htm 和template\default\common\fooer_ajax.htm 配合着使用,请尽量不要更改
页:
[1]