十一月
17

完成Custom Skin后,希望只有在用户登录之后才显示导航栏和工具栏。

有了Custom Skin的经验,我知道该功能一定要修改PHP代码才能实现。于是再次仔细阅读customskin.php代码,发现customTemplate是扩展自QuickTemplate的,页面Title是通过<?php $this->text(’pagetitle’) ?>的形式输出的,在文件中搜索QuickTemplate, 找到/includes/SkinTemplate.php, 阅读这个文件,在191行(这里以mediawiki-1.8.2为例)看到代码中以set的方式设置了key为pagetitle对应的值,继续阅读,还可以看到一系列的key value对应的值,在262行设置了username的值,这正是我所希望得到的,于是在customskin.php中加入以入代码,就可以限制只有登录用户才看到的内容:

<?php if($this->data[’username’]) { ?> <!–if user login in, then start side–>

……

<?php } ?> <!–if user login in, the end side–>

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg

Tags:

No Responses

Leave a Response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>