当前位置:首页 > CMS教程 > Discuz > 列表

完美去除discuz x2底部版权和去掉头部“powered by discuz!”

发布:smiling 来源: PHP粉丝网  添加日期:2014-04-03 11:33:14 浏览: 评论:0 

discuz x2自发布以来很多网友希望能够去掉discuz版权,其实做二次开发代码也要考虑discuz既然开放给大家使用了,大家也厚道一点,起码保留一下版权,这是尊重知识产权的基本原则吧,站在网友的立场上本人放出详细去discuz版权的教程,也可以说是完美去版权了,最后提醒大家“慎用!”如有网友侵权引起纠纷,与本人无关,我只是站在技术角度去二次开发,谢谢配合!

一、去除头部版权

在原来的discuz X2版本中,标题中去掉“Powered by Discuz!”版权标识很容易,只需要修改模板文件的头部公用文件,将“Powered by Discuz!”这一行字去掉即可。

但是discuz X2 似乎对这点有所防备,把-Powered by Discuz!中的-放在了变量里,所以删除后,标题一句话结束后会有一个小-尾巴,对搜索引擎很不友好,所以也有一个好的办法完美解决,即:

打开\template\default\common\header_common.htm文件,找到<title><!–{if !empty($navtitle)}–>$navtitle – <!–{/if}–><!–{if empty($nobbname)}–> $_G['setting']['bbname']-<!–{/if}–>Powered by Discuz!</title>

将其中的“Powered By Discuz!”字串改为“{lang secondtitle}”。

再打开source/language/lang_template.php。 在变量的最后,也就是整个数组的目录后按以前的格式,加上“‘secondtitle’ => ‘你的论坛名称!”,” 。

更新缓存即可。

二、去除底部的版本

打开template\default\common,找到footer.htm文件,用deamweaver打开,点击编辑,再点击查找和替换powerd by,知道相应的位置把底部版权的相应内容改了就ok了,注意修改下面红色标记部分

</div>

<!--{if empty($topic) || ($topic[usefooter])}-->
 <!--{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} &raquo;</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="ft" class="wp cl">
  <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.phpfensi.com/" 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>
  <div id="frt">
   <p>Powered by <strong><a href="http://www.baidu.com/" target="_blank">百度</a></strong> <em>$_G['setting']['version']</em><!--{if !empty($_G['setting']['boardlicensed'])}--> <a href=http://www.baidu.com target="_blank">Licensed</a><!--{/if}--></p>
   <p class="xs0">&copy; 2001-2011 <a href="http://www.baidu.com" target="_blank">百度Inc.</a></p>
  </div>
  <!--{eval updatesession();}-->
  <!--{if $_G['uid'] && $_G['group']['allowinvisible']}-->
  <script type="text/javascript">
  var invisiblestatus = '<!--{if $_G['session']['invisible']}-->{lang login_invisible_mode}<!--{else}-->{lang login_normal_mode}<!--{/if}-->';
  var loginstatusobj = $('loginstatusid');
  if(loginstatusobj != undefined && loginstatusobj != null) loginstatusobj.innerHTML = invisiblestatus;
  <!--{/if}-->
  </script>
 </div>
 
 <!--{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}-->
 
<!--{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}-->
 <!--{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();}-->
<span id="scrolltop" onclick="window.scrollTo('0','0')">{lang scrolltop}</span>
<script type="text/javascript">_attachEvent(window, 'scroll', function(){showTopLink();});</script>
<!--{eval output();}-->
</body>
</html>

Tags: discuz 底部 头部 版权

分享到: