Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[已解决] header 和footer模板部分必要代码解析

[复制链接]
evenzhou 发表于 2011-3-29 18:34:13 | 显示全部楼层 |阅读模式
本帖最后由 evenzhou 于 2011-3-30 09:19 编辑

===================Discuz! X1.5版本======================
template\default\common\head_common.htm文件中:


  1. <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" />
  2. <meta name="keywords" content="{if !empty($metakeywords)}{echo htmlspecialchars($metakeywords)}{/if}" />
  3.          <meta name="description" content="{if !empty($metadescription)}{echo htmlspecialchars($metadescription)} {/if},$_G['setting']['bbname']" />
复制代码
title部分和keywordsdiscription。在后台中的 搜索引擎优化设置
$_G['setting']['seohead'] 对应后台的其他头部信息设置
这代码是对样式文件的加载<!--{csstemplate}-->

  1. <script type="text/javascript">var STYLEID = '{STYLEID}', STATICURL = '{STATICURL}', IMGDIR = '{IMGDIR}', VERHASH = '{VERHASH}', charset = '{CHARSET}', discuz_uid = '$_G[uid]', cookiepre = '{$_G[config][cookie][cookiepre]}', cookiedomain = '{$_G[config][cookie][cookiedomain]}', cookiepath = '{$_G[config][cookie][cookiepath]}', showusercard = '{$_G[setting][showusercard]}', attackevasive = '{$_G[config][security][attackevasive]}', disallowfloat = '{$_G[setting][disallowfloat]}', creditnotice = '<!--{if $_G['setting']['creditnotice']}-->$_G['setting']['creditnames']<!--{/if}-->', defaultstyle = '$_G[style][defaultextstyle]', REPORTURL = '$_G[currenturl_encode]', SITEURL = '$_G[siteurl]';</script><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
复制代码
初始化必要的js变量
  1. <script type="text/javascript" src="{$_G[setting][jspath]}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
  1. <!--{if $_GET['diy'] == 'yes' && ($_G[mod] == 'topic' || $_G[group][allowdiy]) && (empty($do) || $do != 'index') && !empty($_G['style']['tplfile'])}-->
  2. <script type="text/javascript" src="{$_G[setting][jspath]}common_diy.js?{VERHASH}"></script>
  3. <script type="text/javascript" src="{$_G[setting][jspath]}portal_diy.js?{VERHASH}"></script>
  4. <!--{/if}-->
  5. <!--{if $_GET['diy'] == 'yes' && $space['self'] && $_G[mod] == 'space' && $do == 'index'}-->
  6. <script type="text/javascript" src="{$_G[setting][jspath]}common_diy.js?{VERHASH}"></script>
  7. <script type="text/javascript" src="{$_G[setting][jspath]}space_diy.js?{VERHASH}"></script>
  8. <!--{/if}-->
  9. <!--{if $_G['member']['newprompt'] && (empty($_G['cookie']['promptstate_'.$_G[uid]]) || $_G['cookie']['promptstate_'.$_G[uid]] != $_G['member']['newprompt']) && $_G['gp_do'] != 'notice'}-->
  10. <script type="text/javascript">noticeTitle();</script>
  11. <!--{/if}-->
  12. <!--{eval output();}-->
复制代码

这部分代码是diy时候必要的,如果缺少将不能diy

template\default\common\footer_ajax.htm 和template\default\common\fooer_ajax.htm 配合着使用,请尽量不要更改

评分

1

查看全部评分

lmprinter 发表于 2011-3-29 23:41:39 | 显示全部楼层
传说中的沙发
回复

使用道具 举报

64243354 发表于 2011-3-30 18:55:48 | 显示全部楼层
第2个留言吖 学習了~~
回复

使用道具 举报

kisslbz 发表于 2011-3-30 19:34:00 | 显示全部楼层
什么啊???????????
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-23 09:25 , Processed in 0.121201 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表