What is MediaWiki?
A Wiki is a web application that allows users to create and edit Web Page content using a Web Browser. The term Wiki also refers to the collaborative software used to create such a website, also known as Wiki Software. Wiki Software is usually implemented as a script that runs on a web server with the Wiki content stored in a relational database management system such as MySQL.
What is FCKeditor?
FCKeditor is an open source WYSIWYG text editor that can be used in web pages. It aims to be lightweight, e.g. without requiring much to install before use.
Its core code is written in JavaScript, having server side interfaces with Active-FoxPro, ASP, ASP.NET, ColdFusion, Java, JavaScript, Lasso, Perl, PHP and Python.
In this tutorial i assume you have mediawiki installed on your server.
We will start install FCKeditor as MediaWiki extention.
First, we need to download FCKeditor extention.
We can download it from this URL [code]http://mediawiki.fckeditor.net/nightly/svn/mediawiki_fckeditor_ext_N.tar.gz[/code]
Unpack it and place it in extention directory.
[code]$cd /home/wowwiki/public_html/extensions
$tar -zxvf mediawiki_fckeditor_ext_N.tar.gz
$mv mediawiki_fckeditor_ext_N FCKeditor[/code]
so your extention directory will look like below :
[code]$ls -al
total 824
drwxr-xr-x 3 501 www 512 Dec 13 20:09 .
drwxr-xr-x 16 501 www 1024 Dec 13 20:09 ..
drwxr-xr-x 5 501 www 512 Dec 13 20:09 FCKeditor
-rw-r--r-- 1 501 www 583 Apr 13 2007 README
-rw-r--r-- 1 501 www 809518 Dec 13 00:40 mediawiki_fckeditor_ext_N.tar.gz[/code]
Then add this line at the end of LocalSettings.php:
[code]$cd /home/wowwiki/public_html/
$nano LocalSettings.php
require_once $IP . "/extensions/FCKeditor/FCKeditor.php";[/code]
Next, We are doing everything we can to avoid interferences in mediawiki source files. Currently, only two files needs to be "hacked" to integrate FCKeditor into Mediawiki (one is optional).
(Tested with MediaWiki 1.10.1 and MediaWiki 1.11.0)
1. Edit includes/EditPage.php
This change had to be made to make "Show preview" feature working properly.
getPreviewText()
Before:
[code]global $wgOut, $wgUser, $wgTitle, $wgParser;[/code]
After:
[code]global $wgOut, $wgUser, $wgTitle, $wgParser, $wgRequest;[/code]
Before:
[code]wfProfileIn( $fname );
if ( $this->mTriedSave && !$this->mTokenOk ) {[/code]
After:
[code]wfProfileIn( $fname );
if ($wgUser->getOption( 'showtoolbar' ) && !$wgUser->getOption( 'riched_disable' ) && !$this->previewOnOpen() ) {
$oldTextBox1 = $this->textbox1;
$this->importFormData( $wgRequest );
}
if ( $this->mTriedSave && !$this->mTokenOk ) {[/code]
Before:
[code]wfProfileOut( $fname );
return $previewhead . $previewHTML;[/code]
After:
[code]if ($wgUser->getOption( 'showtoolbar' ) && !$wgUser->getOption( 'riched_disable' ) && !$this->previewOnOpen() ) {
$this->textbox1 = $oldTextBox1;
}
wfProfileOut( $fname );
return $previewhead . $previewHTML;[/code]
2. Edit includes/Parser.php
This change had to be made to correctly convert text with leading space.
doBlockLevels()
Before:
[code]$output .= $this->closeParagraph().'<pre>';[/code]
After:
[code]$output .= $this->closeParagraph().'<pre class="_fck_mw_lspace">';[/code]
3. Edit includes/SpecialPreferences.php (optional)
This patch creates "Rich Editor" tab in "my preferences" section. It is not required for FCKeditor to work.
If you don't add this patch, all configurable options will be in "Misc" tab, that's all.
mainPrefsForm()
Before:
[code]global $wgLivePreview;
$wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'textboxsize' ) . '</legend>
<div>' .
wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) .
' ' .
wfInputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols ) .
"</div>" .
$this->getToggles( array(
'editsection',
'editsectiononrightclick',
'editondblclick',
'editwidth',
'showtoolbar',
'previewonfirst',
'previewontop',
'minordefault',
'externaleditor',
'externaldiff',
$wgLivePreview ? 'uselivepreview' : false,
'forceeditsummary',
) ) . '</fieldset>'
);[/code]
After:
[code]global $wgLivePreview;
$wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'textboxsize' ) . '</legend>
<div>' .
wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) .
' ' .
wfInputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols ) .
"</div>" .
$this->getToggles( array(
'editsection',
'editsectiononrightclick',
'editondblclick',
'editwidth',
'showtoolbar',
'riched_disable', //add new tab (Rich Editor)
'previewonfirst',
'previewontop',
'minordefault',
'externaleditor',
'externaldiff',
$wgLivePreview ? 'uselivepreview' : false,
'forceeditsummary',
) ) . '</fieldset>'
);
# FCKeditor
# load FCKeditor settings into separate tab
if (!$wgUser->getOption( 'riched_disable' )) {
$wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'textrichditor' ) . '</legend>' .
$this->getToggles( FCKeditor_Mediawiki::$nsToggles ) . '</fieldset>'
);
}[/code]
Start your mediawiki and edit your content, FCKeditor will automatically integrated into your mediawiki. If you have any problem with it, please take a look this tutorial more clearly.
ShareThis
Thanks for sharing this information. I found it very informative as I have been researching a lot lately on practical matters such as you talk about...


Great work sentono, keep it up. I love returning back to this site and reading the quality content you always have on offer.


hei zoran
Thank you for your comment :)