(转)discuz教程:制作网站模板前必须了解的界面结构(页头页尾模板文件)
页头文件路径:template/default/common/header.htm
header.htm文件二次加载的文件有:
template/default/common/header_common.htm 全局公共文件
|--该文件中包含了页面TITLE,对浏览器的申明,以及全局必须存在的基本代码,所以不建议新手修改此文件
template/default/common/header_diy.htm DIY模式时加载的DIY浮层菜单
template/default/common/member/login_simple.htm 右上角迷你登陆框(未登录时调用该文件)
</head>以上的代码必须保留,此段代码为所有页面必须使用的脚本、样式载入,去掉后页面将会错误显示!!
除了保留</head>以上的代码,以下代码也是必须存在的
页面中的ajax交互功能必须依赖的代码:
- <div id="append_parent"></div><div id="ajaxwaitid"></div>
DIY功能必须的代码:
- <!--{if $_GET['diy'] == 'yes' && (CURMODULE == 'topic' || $_G['group']['allowdiy']) && !empty($_G['style']['tplfile'])}-->
- <!--{template common/header_diy}-->
- <!--{/if}-->
- <!--{if CURMODULE == 'topic' && $topic && empty($topic['useheader']) && !empty($_G['style']['tplfile']) && ($_G['group']['allowdiy'] || $_G['group']['allowaddtopic'] && $topic['uid'] == $_G['uid'] || $_G['group']['allowmanagetopic'])}-->
- <a id="diy-tg" href="javascript:openDiy();" title="{lang open_diy}" class="y"><img src="{STATICURL}image/diy/panel-toggle.png" alt="DIY" /></a>
- <!--{/if}-->
页头广告调用代码:放置于<div id="hd">上面
- <!--{ad/headerbanner/wp a_h}-->
导航条当前位置获取代码,必须放置于logo代码前面
- <!--{eval $mnid = getcurrentnav();}-->
二级导航调用代码:放置于二级导航代码后面
- <!--{ad/subnavbanner/a_mu}-->
页头搜索条代码,根据自己模板的结构设计放到需要的位置即可
- <!--{subtemplate common/pubsearchform}-->
全局框架代码,该代码的闭合在footer.htm文件第一行</div>中
- <div id="wp" class="wp">
此外页头文件包含几个插件嵌入点代码,作为一个完整的discuz模板,插件钩子是必须存在的:
顶部导航左嵌入点:
- <!--{hook/global_cpnav_extra1}-->
顶部导航右嵌入点:
- <!--{hook/global_cpnav_extra2}-->
右上角登录状态嵌入点(个人设置前面):
- <!--{hook/global_usernav_extra1}-->
右上角登录状态嵌入点(退出按钮前面):
- <!--{hook/global_usernav_extra2}-->
右上角登录状态嵌入点(第二行第一位):
- <!--{hook/global_usernav_extra3}-->
全局页尾
页尾文件路径:template/default/common/footer.htm
页尾文件担负整个模板的重要的收尾工作,如果缺少必须的代码,同样也会导致整个程序各个功能不能正常使用!
页尾文件第一句(必须存在):
- </div>
- PS:这个闭合的标签是页头文件的<div id="wp" class="wp">
站长推荐功能调用代码:
- <!--{eval $focusid = getfocus_rand($_G[basescript]);}-->
- <!--{if $focusid !== null}-->
- <!--{eval $focus = $_G['cache']['focus']['data'][$focusid];}-->
- <div class="focus" id="sitefocus">
- <div class="bm">
- <div class="bm_h cl">
- <a href="javascript:;" onclick="setcookie('nofocus_$focusid', 1, $_G['cache']['focus']['cookie']*3600);$('sitefocus').style.display='none'" class="y" title="{lang close}">{lang close}</a>
- <h2><!--{if $_G['cache']['focus']['title']}-->{$_G['cache']['focus']['title']}<!--{else}-->{lang focus_hottopics}<!--{/if}--></h2>
- </div>
- <div class="bm_c">
- <dl class="xld cl bbda">
- <dt><a href="{$focus['url']}" class="xi2" target="_blank">$focus['subject']</a></dt>
- <!--{if $focus[image]}-->
- <dd class="m"><a href="{$focus['url']}" target="_blank"><img src="{$focus['image']}" alt="$focus['subject']" /></a></dd>
- <!--{/if}-->
- <dd>$focus['summary']</dd>
- </dl>
- <p class="ptn hm"><a href="{$focus['url']}" class="xi2" target="_blank">{lang focus_show} »</a></p>
- </div>
- </div>
- </div>
- <!--{/if}-->
全局页尾广告代码调用(必须存在):
- <!--{ad/footerbanner/wp a_f/1}--><!--{ad/footerbanner/wp a_f/2}--><!--{ad/footerbanner/wp a_f/3}-->
- <!--{ad/float/a_fl/1}--><!--{ad/float/a_fr/2}-->
- <!--{ad/couplebanner/a_fl a_cb/1}--><!--{ad/couplebanner/a_fr a_cb/2}-->
- <!--{ad/cornerbanner/a_cn}-->
页尾插件嵌入点:(必须存在!)
- <!--{hook/global_footer}-->
页尾左框架版权信息(必须存在)
- <div id="frt">
- <p>Powered by <strong><a href="http://www.discuz.net" target="_blank">Discuz!</a></strong> <em>$_G['setting']['version']</em><!--{if !empty($_G['setting']['boardlicensed'])}--> <a href="http://license.comsenz.com/?pid=1&host=$_SERVER[HTTP_HOST]" target="_blank">Licensed</a><!--{/if}--></p>
- <p class="xs0">© 2001-2011 <a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a></p>
- </div>
页尾有框架菜单、备案、执行时间、统计代码
- <div id="flk" class="y">
- <p>
- <!--{loop $_G['setting']['footernavs'] $nav}--><!--{if $nav['available'] && ($nav['type'] && (!$nav['level'] || ($nav['level'] == 1 && $_G['uid']) || ($nav['level'] == 2 && $_G['adminid'] > 0) || ($nav['level'] == 3 && $_G['adminid'] == 1)) ||
- !$nav['type'] && ($nav['id'] == 'stat' && $_G['group']['allowstatdata'] || $nav['id'] == 'report' && $_G['uid'] || $nav['id'] == 'archiver' || $nav['id'] == 'mobile'))}--><!--{if $nav['id'] == 'mobile' && $_G['setting']['mobile']['allowmobile'] != 1}--><!--{eval continue;}--><!--{/if}-->$nav[code]<span class="pipe">|</span><!--{/if}--><!--{/loop}-->
- <strong><a href="$_G['setting']['siteurl']" target="_blank">$_G['setting']['sitename']</a></strong>
- <!--{if $_G['setting']['icp']}-->( <a href="http://www.miitbeian.gov.cn/" target="_blank">$_G['setting']['icp']</a> )<!--{/if}-->
- <!--{hook/global_footerlink}-->
- <!--{if $_G['setting']['statcode']}-->$_G['setting']['statcode']<!--{/if}-->
- </p>
- <p class="xs0">
- {lang time_now}
- <span id="debuginfo">
- <!--{if debuginfo()}-->, Processed in $_G[debuginfo][time] second(s), $_G[debuginfo][queries] queries
- <!--{if $_G['gzipcompress']}-->, Gzip On<!--{/if}--><!--{if $_G['memory']}-->, <!--{echo ucwords($_G['memory'])}--> On<!--{/if}-->.
- <!--{/if}-->
- </span>
- </p>
- </div>
用户活动信息记录代码(必须存在):
- <!--{eval updatesession();}-->
- PS:缺少该代码直接导致用户在线时间等信息无法记录
用户升级信息弹出层:(页头右上角用户组连接弹出)
- <!--{if $upgradecredit !== false}-->
- <div id="g_upmine_menu" class="tip tip_3" style="display:none;">
- <div class="tip_c">
- {lang credits} $_G[member][credits], {lang thread_groupupgrade} $upgradecredit {lang credits}
- </div>
- <div class="tip_horn"></div>
- </div>
- <!--{/if}-->
用户短消息、站点邮件发送触发代码(必须存在)
- <!--{if !$_G['setting']['bbclosed']}-->
- <!--{if $_G[uid] && !isset($_G['cookie']['checkpm'])}-->
- <script type="text/javascript" src="home.php?mod=spacecp&ac=pm&op=checknewpm&rand=$_G[timestamp]"></script>
- <!--{/if}-->
- <!--{if !isset($_G['cookie']['sendmail'])}-->
- <script type="text/javascript" src="home.php?mod=misc&ac=sendmail&rand=$_G[timestamp]"></script>
- <!--{/if}-->
- <!--{/if}-->
使用DIY功能时必须的脚本(必须存在):
- <!--{if $_GET['diy'] == 'yes'}-->
- <!--{if (CURMODULE == 'topic' || $_G['group']['allowdiy']) && (empty($do) || $do != 'index') && !empty($_G['style']['tplfile'])}-->
- <script type="text/javascript" src="{$_G[setting][jspath]}common_diy.js?{VERHASH}"></script>
- <script type="text/javascript" src="{$_G[setting][jspath]}portal_diy.js?{VERHASH}"></script>
- <!--{/if}-->
- <!--{if $space['self'] && CURMODULE == 'space' && $do == 'index'}-->
- <script type="text/javascript" src="{$_G[setting][jspath]}common_diy.js?{VERHASH}"></script>
- <script type="text/javascript" src="{$_G[setting][jspath]}space_diy.js?{VERHASH}"></script>
- <!--{/if}-->
- <!--{/if}-->
用户提醒功能状态变更(必须存在):
- <!--{if $_G['member']['newprompt'] && (empty($_G['cookie']['promptstate_'.$_G[uid]]) || $_G['cookie']['promptstate_'.$_G[uid]] != $_G['member']['newprompt']) && $_G['gp_do'] != 'notice'}-->
- <script type="text/javascript">noticeTitle();</script>
- <!--{/if}-->
漫游通知触发代码:(管理员下弹出漫游通知)
- <!--{eval userappprompt();}-->
返回顶部浮动菜单
- <!--{if $_G['basescript'] != 'userapp'}-->
- <span id="scrolltop" onclick="window.scrollTo('0','0')">{lang scrolltop}</span>
- <script type="text/javascript">_attachEvent(window, 'scroll', function(){showTopLink();});</script>
- <!--{/if}-->
程序功能最后处理代码(必须存在)
- <!--{eval output();}-->
- PS:伪静态、模块更新、Gzip等等
posted on 2017-09-16 16:40 alleyonine 阅读(1287) 评论(0) 编辑 收藏 举报