<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d4684235500622716427\x26blogName\x3dCaiwangqin\x27s+blog\x26publishMode\x3dPUBLISH_MODE_HOSTED\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://blog.caiwangqin.com/search\x26blogLocale\x3dzh_CN\x26v\x3d2\x26homepageUrl\x3dhttp://blog.caiwangqin.com/\x26vt\x3d3393395200455623441', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Caiwangqin's blog

Focus on Life, Cloud Service, Smart Hardware, Architecture, Technic and beyond…

MediaWiki Research - QuickTemplate

2006年11月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–>



标签:

posted by Caiwangqin, 06:52

0 Comments:

发表评论

订阅 博文评论 [Atom]

<< 主页