Andrew Guyton's Blog

Late at night, I wondered about the best way to share a Christmas list. Mainly, I didn’t want another big bag of car accessories, but I digress. The solution: a wiki.

If you want to skip past the part where I talk about the Christmas list, and get straight to installing your wiki, click here or scroll down to the “Installation” section.

In Defense of a Wiki

I’m rather familiar with the workings of a wiki from an editor’s perspective, which is probably why I thought of this idea. Also, I’ve seen a couple instances of people using wikis rather well in the workplace and at home. True, these are very nerdy people sharing these wikis with other nerdy people. I wanted to share my wiki with people who didn’t necessarily have computing knowledge.

A major feature I wanted was the ability for multiple relatives to collaborate on the list itself. That way, you can “give” one list to as many relatives as you want, and they could “claim” an item. At this point, if you want to edit your own wish list, you have to get someone else to change it for you. That’s not a problem for me, I can just get Hillary to fix it. A template-based solution might let you change the page without going back to it, but I didn’t try anything that complex because I wanted it extremely useable.

A List for Santa

The template I used for a Christmas list is here; sub in the recipient’s name for (name) and the correct pronoun for (him/her); or see it in action here:

This is a '''list of the items (name) wants for Christmas'''.
__NOTOC__
==Instructions==
If you decide to buy (him/her) an item, please '''mark it as claimed''':
#'''Click the [edit] link''' to the right of the item
#Change "No" to "Yes."
#Click save

===Notes===
*'''Claiming is anonymous.'''
*(name) will not look at this page (honor system)
*Please don't make changes to the page unless you are claiming/unclaiming or fixing a link.
*Priority is on a 1 to 10 scale.

==Items==
===Sample Item===
*Price: $99.99
*Link: [http://www.amazon.com/sample_item/ Sample Item]
*Priority: 6
*Claimed: No

Automagically hiding the TOC (thanks to the keyword __NOTOC__ was a personal choice. You might choose to link to another gift list (say, an Amazon wishlist), or simply integrate those items into this list.

Installation

Note that the rest of this article applies to wikis in general, and applies no matter what you’ll be using your wiki for.

Installing MediaWiki, the software in question, is extremely easy. It goes something like this, assuming you already have a webserver with php and mysql installed:

  1. Download MediaWiki.
  2. Unzip MediaWiki.
  3. Put MediaWiki in a publically-accessible folder.
  4. Open index.php in a browser.
  5. Answer a few simple questions (wiki name, etc).
  6. Enjoy.

That’s it. You don’t touch a scrap of html, php, or mysql to get your wiki running. For a slightly more detailed page on installing it under XAMPP and Windows, see here; for XAMPP and linux, see here; otherwise, see the offical installation help page. Also, Resonant has a fairly good installation and configuration guide.

Initial Configuration

Configuring a wiki is more difficult than installing it, depending on what you want to do with your wiki. The default installation is, given the nature of wikis, open for anyone to edit. The default installation doesn’t allow file uploads, and doesn’t have any of the useful templates and categories that I, for one, am used to using. The first step to configuring your wiki is to follow the prompt at the end of the installation and copy wiki\config\LocalSettings.php to wiki\LocalSettings.php. That file is what you will edit to change major settings of your wiki. You’ll probably want to replace the image in the top-left; either replace wiki/common/images/wiki.png with a better image, or change LocalSettings.php so that $wgLogo equals the address of your preferred image.

User Rights

I decided that I didn’t need all of the pages accessible to users. In fact, the only pages they needed to see were the pages I sent them. If you go to my wiki, you’ll discover that:

  • You can’t do anything.
  • You can’t even register :(
  • This is fucking boring.

This is because I added the following code to my LocalSettings.php:

# Pages anonymous (not-logged-in) users may see
$wgWhitelistRead = array( "Special:Userlogin", "-", "MediaWiki:Monobook.css", "User:127.0.0.1" );
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['createaccount'] = false;

Obviously, I also add the Christmas lists I’m hosting to the whitelist. Thus, users only use the pages they were meant to. That’s what I call secure. If you really want to play with a page on my wiki, you can read and/or edit this sample list. Georgia Tech students know George rather well. Perhaps they’d like to get him something?

However, these preferences aren’t for everybody. For a more in-depth approach to user permissions, see MediaWiki Manual:Preventing Access, or if your question isn’t answered there, try the MediaWiki FAQ or the section of Resonant’s guide. If you haven’t already figured it out, the more technical stuff is buried in a thousand pages spread across the internet.

Images

To enable image uploads, set the following in LocalSettings.php:

$wgEnableUploads = true;

To enable uploads of other than the default types, add the following to LocalSettings.php with your preferred set of types:

$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'pdf', 'tif', 'tiff', 'svg' );

For more on image uploads, see Meta:Uploading Files. For more on SVG, see Meta:SVG image support. Unfortunately, I have been unsuccessful in my attempts to get ImageMagick to run, so I can’t advise you on that. Theoretically, I could upload an SVG image to my wiki and have it work just fine. But nooo…

Interwiki Links

If you don’t feel like creating a page for every general concept, then you can use InterWiki internal links. There are two types of InterWiki links: ones that serve to show the user that a version of that page exists in another wiki (perhaps a different language), and ones that send the user to a certain page on a different wiki. Use one while expecting the other, and you will be greatly dissapointed. The interwiki links that MediaWiki installs with are the first type; we want the second type. If you try to use the first type as the second type, MediaWiki just eats the text. You’d never know anything was there. So, off to install our own. Doing this was my first foray into mysql. So, since my copy of mysql isn’t in the PATH, I had to navigate to it to do this. However, depending on your installation, you may be able to just use it and not worry about that.

  1. From the shell, enter: mysql -u root -p and type in the MySQL root password when prompted.
  2. (optional) For a list of available databases, enter SHOW databases;
  3. Enter USE wikidb; (where wikidb is the name of your wiki’s database)
  4. (optional) For a list of available tables inside of wikidb, enter SHOW tables; (the one we’ll be dealing with is named “interwiki”)
  5. Enter the following, assuming you want [[w:Wikipedia]] to point to en.wikipedia.org/wiki/Wikipedia:
    REPLACE INTO interwiki (iw_prefix,iw_url,iw_local) VALUES
    ('w','http://www.wikipedia.org/wiki/$1',1);
  6. A complete listing of the interwiki links can be seen by entering SELECT * FROM interwiki; (although be warned, the list is rather long. You may have to increase the screen buffer size to see all of them. To do so, right click the title bar, click properties; it’s the second box under the layout tab.)
  7. You can quit mysql by entering exit or quit.

That was fun, wasn’t it?

Conclusion

Hopefully, I’ve helped someone get a Wii, or at least, something they want. Let me know if you end up using this idea! :)

Leave a Reply

 

Powered by WordPress and theme developed using WordPress Theme Generator.
Copyright © Andrew Guyton. All rights reserved. Feeds: Entries (RSS) and Comments (RSS).