您当前的位置:首页 > 网站建设笔记 >

discuzX3.3 1_1_common_header_forum_index.tpl.php

0
<div id="toptb" class="cl">
  <!--{hook/global_cpnav_top}-->
  <div class="wp">
    <div class="z">
      <!--{loop $_G['setting']['topnavs'][0] $nav}-->
        <!--{if $nav['available'] && (!$nav['level'] || ($nav['level']==1 && $_G['uid']) || ($nav['level']==2 && $_G['adminid']>0) || ($nav['level']==3 && $_G['adminid']==1))}-->$nav[code]<!--{/if}-->
      <!--{/loop}-->

      <!--{hook/global_cpnav_extra1}-->
    </div>
    <div class="y">
      <a id="switchblind" href="javascript:;" onclick="toggleBlind(this)" title="{lang switch_blind}" class="switchblind">{lang switch_blind}</a>
      <!--{hook/global_cpnav_extra2}-->

      <!--{loop $_G['setting']['topnavs'][1] $nav}-->
        <!--{if $nav['available'] && (!$nav['level'] || ($nav['level']==1 && $_G['uid']) || ($nav['level']==2 && $_G['adminid']>0) || ($nav['level']==3 && $_G['adminid']==1))}-->$nav[code]<!--{/if}-->
      <!--{/loop}-->

      <!--{if empty($_G['disabledwidthauto']) && $_G['setting']['switchwidthauto']}-->
        <a href="javascript:;" id="switchwidth" onclick="widthauto(this)" title="{if widthauto()}{lang switch_narrow}{else}{lang switch_wide}{/if}" class="switchwidth"><!--{if widthauto()}-->{lang switch_narrow}<!--{else}-->{lang switch_wide}<!--{/if}--></a>
      <!--{/if}-->

      <!--{if $_G['uid'] && !empty($_G['style']['extstyle'])}-->
      <a href="javascript:;" id="sslct" onmouseover="delayShow(this,function(){showMenu({'ctrlid':'sslct','pos':'34!'})});">{lang changestyle}</a>
      <!--{/if}-->
    </div>
  </div>
</div>

解析模板后实际的模板代码如下:

<div id="toptb" class="cl">
  <?php if(!empty($_G['setting']['pluginhooks']['global_cpnav_top'])) echo $_G['setting']['pluginhooks']['global_cpnav_top'];?>
  <div class="wp">
    <div class="z">
      <?php 
        if (is_array($_G['setting']['topnavs']['0'])) {
          foreach ($_G['setting']['topnavs']['0'] as $nav) {
            if ($nav['available'] && (!$nav['level'] || ($nav['level']==1 && $_G['uid']) || ($nav['level']==2 && $_G['adminid']>0) || ($nav['level']==3 && $_G['adminid']==1))) {
      ?>
      <?php echo $nav['code'];?>
      <?php }}} ?>

      <?php if(!empty($_G['setting']['pluginhooks']['global_cpnav_extra1'])) echo $_G['setting']['pluginhooks']['global_cpnav_extra1'];?>
    </div>
    <div class="y">
      <a id="switchblind" href="javascript:;" onclick="toggleBlind(this)" title="开启辅助访问" class="switchblind">开启辅助访问</a>
      <?php if(!empty($_G['setting']['pluginhooks']['global_cpnav_extra2'])) echo $_G['setting']['pluginhooks']['global_cpnav_extra2'];?>

      <?php
        if (is_array($_G['setting']['topnavs']['1'])) {
          foreach ($_G['setting']['topnavs']['1'] as $nav) {
            if ($nav['available'] && (!$nav['level'] || ($nav['level']==1 && $_G['uid']) || ($nav['level']==2 && $_G['adminid']>0) || ($nav['level']==3 && $_G['adminid']==1))) {
      ?>
      <?php echo $nav['code'];?>
      <?php }}}
        if (empty($_G['disabledwidthauto']) && $_G['setting']['switchwidthauto']) {
      ?>
      <a href="javascript:;" id="switchwidth" onclick="widthauto(this)" title="<?php if(widthauto()) { ?>切换到窄版<?php } else { ?>切换到宽版<?php } ?>" class="switchwidth"><?php if(widthauto()) { ?>切换到窄版<?php } else { ?>切换到宽版<?php } ?></a>
      <?php }

        if($_G['uid'] && !empty($_G['style']['extstyle'])) {
      ?>
      <a href="javascript:;" id="sslct" onmouseover="delayShow(this,function(){showMenu({'ctrlid':'sslct','pos':'34!'})});">切换风格</a>
      <?php } ?>
    </div>
  </div>
</div>
$_G['setting']['topnavs'] = array(
    0 => array(
        'sethomepage'=>array(
            'available'=>'1',
            'navname'=>'设为首页',
            'code'=>'<a href="javascript:;" onclick="setHomepage(\'http://www.pcool.com/\');">设为首页</a>',
            'type'=>'0',
            'level'=>'0',
            'id'=>'setHomepage',
        ),
        'setfavorite'=>array(
            'available'=>'1',
            'navname'=>'收藏本站',
            'code'=>'<a href="http://www.wangzhanchengxu.com/" onclick="addFavorite(this.href, \'网站程序网交流社区\');return false;">收藏本站</a>',
            'type'=>'0',
            'level'=>'0',
            'id'=>'setfavorite',
        ),
    ),
);
$_G['disabledwidthauto'] = 0;
//后台界面-界面设置-全局-站点宽窄风格
//1为窄屏(固定宽度),0为宽屏(自由宽度),设置站点的显示风格是宽版还是窄版。其中论坛的版块中还可以进行独立的设置
$_G['setting']['allowwidthauto'] = '1';
//设置是否允许用户自由切换宽窄风格,1是,0否
$_G['setting']['switchwidthauto'] = '1';

$_G['style']['extstyle'] = array(
    0=>array(
        0=>'./template/default/style/t1',
        1=>'红',
        2=>'#BA350F',
    ),
    1=>array(
        0=>'./template/default/style/t2',
        1=>'青',
        2=>'#429296',
    ),
    2=>array(
        0=>'./template/default/style/t3',
        1=>'橙',
        2=>'#FE9500',
    ),
    3=>array(
        0=>'./template/default/style/t4',
        1=>'紫',
        2=>'#9934B7',
    ),
    4=>array(
        0=>'./template/default/style/t5',
        1=>'蓝',
        2=>'#0053B9',
    ),
);

建站咨询

在线咨询真诚为您提供专业解答服务

咨询热线

137 1731 25507×24小时服务热线

微信交流

二维码终于等到你,还好我没放弃
返回顶部