allwiki首页  
天下维客 你可以修改的网络知识库
首页最近更改优秀条目专题展示电脑科技词典软件学习网络知识电脑安全明星时尚天下百科
 

MediaWiki导航条的定制

天下维客,你可以修改的网络知识库

Jump to: navigation, search

本文取自元维基,欢迎共同翻译、整理与大家共享,促进中文wiki发展^_^

注意:这个实际上介绍的是定义工具栏。原文参见: <a href="/wiki/Customizing:Edit_Toolbar" title="Customizing:Edit Toolbar">Customizing:Edit Toolbar</a>

You can customize the Edit Toolbar quite easily.

In the ...wiki/includes/ directory you will find a file called Skin.php. Don't forget to make a copy before changing it, just in case (cp Skin.php Skin.php~).

Note: In Mediawiki 1.5, this can be found in ...wiki/includes/EditPage.php at line 1017.

Note: In Mediawiki 1.6.7, this can be found in ...wiki/includes/EditPage.php at line 1452.

Add the new button code after line 2780, as the example above

array(	'image'=>'button_bold.png',
	'open'	=>	"\'\'\'",
	'close'	=>	"\'\'\'",
	'sample'=>	wfMsg('bold_sample'),
	'tip'	=>	wfMsg('bold_tip'),
	'key'	=>	'B'
),

It is easy to work out from the names of the button image files which array is related to which function and you can delete buttons from the Edit Toolbar by simply removing the appropriate array lines.

You can change the image used by the buttons by changing the button_NNNN.png files - stored in the .../wiki/stylesheet/images/ directory. - This directory appears to not be present in 1.5.3 use .../skins/common/images instead.

You can add buttons to the array by simply adding a new array definition - one reason to do this is to help users structure pages by adding a pre-defined set of headers, rules or advice.

Example

For example to add a button that makes the selected text yellow and reduces its size:

  1. make a button for your edit function (the standard size is 23 x 22 pixels)
  2. save it in the .../stylesheet/images file - (I could not find this directory in 1.5.3 - looks like it should be in .../skins/common/images )
  3. open ...wiki/includes/
  4. Mediawiki 1.4 and older: rename Skin.php to Skin.php~
  5. Mediawiki 1.5 and newer: rename EditPage.php to EditPage.php~
  6. open it up and add the new button to the array by inserting:
array(	'image'=>'button_smaller_yellow.png',
	'open'	=>	"<font size=\"-1\" color=\"#FFFF00\">",
	'close'	=>	"</font>",
	'sample'=>	wfMsg('sample'),
	'tip'	=>	wfMsg('tip'),
	'key'	=>	'R'
),
7. Mediawiki 1.4 and older: save as Skin.php
8. Mediawiki 1.5 and newer: save as EditPage.php
9. open a browser and make a new page in your wiki and check that the new button is working.
10. make speci al pages to define the sample and tooltip text, in the above sample: [[MediaWiki:smallyellow_sample]] and [[MediaWiki:smallyellow_tip]]

Tips

  • Add your own text inside the array using the Wiki Mark Up: ==Headline1==\\n\\n==Headline2== (\\n is a line break, and \\n\\n adds a blank line)
  • Remember not to use apostrophies
  • Remember to use \" with html text requiring the quote mark.
  • use
    <!-- HTML Comments tags -->
    if you don't want text to show up on the final wiki page.
  • You need to add a special page so you can edit the wfMsg text - otherwise the tip text file name appears inside angled brackets when your pointer rolls over the button. Examples: MediaWiki:Nowiki sample and MediaWiki:Nowiki tip
  • You can place the new button anywhere on the edit toolbar -- just insert the
    array()
    line in between the sections for the buttons where you want to insert your new one.


原文参见: Customizing:Edit Toolbar

以上并不是导航条的定制而是工具条的定制

Personal tools
工具
金银币拍卖 金币拍卖预展  金银币网店 熊猫金银币 生肖金银币