MediaWiki


Many applications are available for publishing wikis. I've chosen to discuss MediaWiki because it's written in PHP, so it can be installed at a wide range of web hosts, and because it is relatively simple to set up. MediaWiki is also widely adopted, and it's the plumbing for Wikipedia, the most popular wiki. Because of its popularity, the software is undergoing constant improvement, and a large collection of extensions is available for the software.

The main downside of publishing a site using MediaWiki is that it won't give you a great opportunity to use or improve your HTML skills. Content in MediaWiki is entered using MediaWiki's internal markup language. MediaWiki markup is translated into HTML tags, though, so even though you use different syntax, a knowledge of how web pages are constructed will still help you lay out your pages using MediaWiki's markup language. Here's an example of MediaWiki markup:

== Sample Heading == This is a paragraph. This is a paragraph containing '''Bold text'''. Here's an [http://www.example.com outbound link].


And here's the equivalent in HTML:

<h2> Sample Heading </h2> <p>This is a paragraph.</p> <p>This is a paragraph containing <b>Bold text</b>.</p> <p>Here's an <a href="http://www.example.com">outbound link</a>.


The first thing you should notice is that unlike HTML, in MediaWiki markup, white space counts. When you skip lines between paragraphs, MediaWiki converts those breaks into paragraph tags. Headings are specified using equals signs. Two equals signs are converted to <h2>, four are converted to <h4>, and so on. MediaWiki markup can also be used to apply inline tags as well as block-level tags. As you can see, I used ''' to make some text bold, and I created an outbound link from the wiki. You can also use MediaWiki markup to create tables, include images in pages, and take on most of the other tasks that you can accomplish with HTML. There's a guide to MediaWiki's markup language at the following page:

http://meta.wikimedia.org/wiki/Help:Editing

This is a wiki page, and if you had some information to add to the discussion of wiki markup, you could add it.

Downloading and Installing MediaWiki

The download and installation process for MediaWiki is similar to the process for WordPress. To download the software, go to http://www.mediawiki.org/wiki/Download.

Find the most recent release and download that archive. Once you've expanded the archive, rename the folder, which probably has a name such as mediawiki-1.5.8. The name you give it will appear in the URL, so you probably want to pick mediawiki or just wiki. Upload or copy all the files into the document root of your server (or into the directory where you want the wiki to reside) and then go to the URL where you just uploaded the files. You'll see a page like the one in Figure 21.10, which indicates that you need to go through the MediaWiki installation process.

Figure 21.10. MediaWiki needs to be installed.


When you click on the setup link, the MediaWiki install script checks to make sure your server is configured properly and has the software that you need for MediaWiki to work. It also asks you to answer a few questions. Some are easy, such as the name of the site and the email address for the person running the site. Others are not so easy, such as the caching configuration. You can safely choose "no caching" for that one.

If MediaWiki is able to write to your configuration files (based on the permissions on those files and the privileges that the web server runs with), it allows you to enter all your database configuration settings right on the installation page. If you have root (administrator) access to your MySQL server, MediaWiki will even create a dedicated database and user for you. If you're using shared hosting, you'll probably have to enter the database name and login information for your database and then let MediaWiki create its tables. MediaWiki, like WordPress, lets you pick a prefix for your table names so that you can avoid naming conflicts if multiple applications use the same database. Once setup is complete, MediaWiki requests that you move the configuration file it created to the proper location, and then you can begin editing content.

If everything is set up properly, MediaWiki installation can be painless. Unfortunately, with these types of applications, there's always an opportunity for something to go wrong. If you run into trouble, check out the MediaWiki installation guide:

http://meta.wikimedia.org/wiki/Help:Installation

The settings for MediaWiki are found in the file LocalSettings.php, which MediaWiki may have generated for you. You can find a full list of configuration settings at the following location:

http://www.mediawiki.org/wiki/Help:Configuration_settings

MediaWiki will work fine with the default settings, but you'll probably at least want to add your own logo to replace the placeholder image. MediaWiki also supports themes, which are called skins in the MediaWiki world. A big list of skins that you can download and install can be found here:

http://meta.wikimedia.org/wiki/Gallery_of_user_styles

Users can change their personal settings to use any skin that's installed. To change the default skin for the site, edit the $wgDefaultSkin variable in your LocalSettings.php file.

Using MediaWiki

Once you've got MediaWiki set up however you like, you can start entering content of your own. In fact, if you go with the default installation, anyone who sees your site can start entering content of his or her own. Every page in a wiki has an edit link on it, allowing you to jump in and make changes. To add an internal link in MediaWiki, you enclose the name of the page in double square brackets, like this:

[[My New Page]]


When you click on the link, you'll be asked to fill in the body of the new page. That's all there is to it. You can also create a new page by entering its name directly into the URL. If you enter a URL, such as http://localhost:8888/mediawiki/index.php/Flying_Monkeys, and a page named "Flying Monkeys" does not exist, it will be created automatically. Wikis tend to grow organically; as people need new pages, they create them by linking to them. With a wiki, it's really easy to move content from one page to another, split one long page into several smaller pages, and generally manage your content however you see fit.

MediaWiki keeps track of every change made to every page. On each page you'll see a history tab that you can click on to see all the edits ever made to that page. The history page for the home page of my new wiki appears in Figure 21.11.

Figure 21.11. The edit history for a wiki page.


From the history page, you can compare revisions of a page or view the old revisions. To revert a page back to the old version, view that version, click on Edit, and then save the page. MediaWiki will warn you that you're replacing newer content, but if you're reverting changes, you can ignore the warnings.




Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day
Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition)
ISBN: 0672328860
EAN: 2147483647
Year: 2007
Pages: 305

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net