修改mediawiki的個人筆記

1)我怎样才能禁止匿名用户编写任何页面
LocalSettings.php底部加入$wgGroupPermissions['*']['edit'] = false;

2)我怎样才能禁止匿名用户阅读任何页面?
LocalSettings.php底部加入$wgGroupPermissions['*']['read'] = false;

3)我怎样才能限制帐户的创建?
LocalSettings.php底部加入$wgGroupPermissions['*']['createaccount'] = false;

4)我怎樣允許添加外部圖片?並且開啟alt標籤?
$wgAllowExternalImages = true;$wgAllowImageTag = true;

5)我应该怎样修改logo
出现在每一页左上方的logo是在LocalSettings.php文件中配置$wgLogo变量实现的。
有两种方法来修改logo
使用你的wiki上传一幅图像并使用它的地址。这样会使得图像的替代变得非常简单,因此如果您要使用这一办法,请保护该图像的页面。
然后在LocalSettings.php中增加$wgLogo一行,例如:
$wgLogo = 'http://yourwiki.org/wiki/images/6/62/photoname.jpg';

或者通过其他途径(如FTP)将图像上传到服务器上,然后在LocalSettings.php中增加$wgLogo一行,例如:
$wgLogo = "{$wgScriptPath}/photoname.jpg";
在上面的例子中,图像是与LocalSettings.php文件处于同一目录下的。
将这一行放在LocalSettings.php的末尾通常是较好的做法,特别是当你为$wgStylePath$wgUploadPath指定参数后。

警告! 警告:请勿只覆盖MediaWiki安装后的默认logo/skins/common/images/wiki.png);这样在你升级后该文件会被改回。
提示:logo图像的大小应为135 x 135像素。

6)我能定制左上角的logo吗?应该怎样做?
logo位于pBody部分外的portlet块中。可以通过p-logo id来识别出。背景图像是由wgLogo变量指定的,该变量定义于/includes/DefaultSettings.php中。它的地址相对于网页服务器的根目录,而非系统根目录。在/LocalSettings.php重定义该变量即可改变图像。如果设置有错,页面将不会出现图像;检查您的网页服务器错误日志,并作出相应的调整。同时,如果logo没有进行修剪,就应亦应确保p-logo的大小能足以盛放它。这需要在样式表中对p-logo样式进行设置(monobook下的Main.css),其默认设置见下:

#p-logo {
    z-index: 3;
    position:absolute; /*needed to use z-index */
    top: 0;
    left: 0;
    height: 155px;
    width: 12em;
    overflow: visible;
}
補充:修改logo大小
Reducing the size of the logo[edit | edit source]
Note that a tag is on top of the logo so if you are trying to reduce the size of the logo's portlet you will also need to change the #p-logo a and #p-logo a:hover rules. The default setting for these is:

#p-logo a,
#p-logo a:hover {
   display: block;
   height: 200px;
   width: 12.2em;
   background-repeat: no-repeat;
   background-position: 35% 50% !important;
   text-decoration: none;
}
This simple customization will re-define the size of all of them at once...

#p-logo,
#p-logo a,
#p-logo a:hover {
   height: 75px;
}
There is one more rule controlling the amount of space between the logo and first portlet in the side column - the padding on the top of #column-one. By default this is:

#column-one { padding-top: 160px; }
If you want to remove the logo completely, comment out the wgLogo variable. Then set the column-one padding to a small value, such as 21:

#column-one { padding-top: 21px; }

You shouldn't edit the CSS file directly. You need go to <Your Wiki URL>?title=MediaWiki:Monobook.css. Hit edit and make your changes there. The content of MediaWiki:Monobook.css page always overrides the default main.css file's contents.

Post a Comment

0 Comments