MediaWiki 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 file:///G|/1/0672328860/ch21lev1sec7.html (1 von 4) [19.12.2006 13:50:22] MediaWiki 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: file:///G|/1/0672328860/ch21lev1sec7.html (2 von 4) [19.12.2006 13:50:22] MediaWiki 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. [View full size image] file:///G|/1/0672328860/ch21lev1sec7.html (3 von 4) [19.12.2006 13:50:22] MediaWiki 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. file:///G|/1/0672328860/ch21lev1sec7.html (4 von 4) [19.12.2006 13:50:22] Coppermine Coppermine Coppermine is a photo gallery package written in PHP. It is designed to make it easy to upload and present images within web pages. Like MediaWiki and WordPress, PHP, and MySQL, Coppermine also requires that you have one of two image-processing applications installedGD or ImageMagick. (The most recent versions of PHP include GD.) Most web hosting providers will have at least one of these packages installed; many applications that have image-related features rely on these applications. If you run your own server, you'll have to install one of these applications yourself (assuming neither is already installed). You can download the Coppermine software at http://coppermine-gallery.net. You can read more about ImageMagick at http://www.imagemagick.org. If you want to install GD, its home page is http://www.boutell.com/gd/. As with the other applications, Coppermine requires you to perform some tasks on the server. In this case, Coppermine needs permission to write to various directories in its installation. On servers running Linux or any other variety of UNIX, every application runs as a user. Usually Apache runs as the user apache or www, an account that is associated only with that server. Because the files in your account are most likely owned by you, not Apache, by default it won't have permission to write to those files. So if your application needs to save, modify, or delete files, you'll have to give Apache permission to do that. Generally, the easiest way to do this is to just give everyone write access to the file or directory. If you have a shell account, you can just do the following: chmod 777 albums This gives the owner, the owner's group, and everyone else access to read, write, and execute the files in the albums directory. Most FTP clients also enable you to change the permissions for files and directories. If yours doesn't, you should find a more full-featured FTP client. Coppermine needs permission to write to several directories, as shown in Figure 21.12. Figure 21.12. Error messages from Coppermine. [View full size image] file:///G|/1/0672328860/ch21lev1sec8.html (1 von 5) [19.12.2006 13:50:23] Coppermine Once I fix the file permissions, Coppermine asks for the same kinds of information that the other applications asked for. It needs to create an account for the administrator of the application, and it needs information about which database to use. Again, you can enter information supplied by your web hosting provider here or create your own database and user if you have the ability to do so. Coppermine also needs to know the path to the ImageMagick convert program. Here's where you might need help from your web hosting provider. If you don't have shell access yourself, they can probably tell you where that application is located, assuming it's installed. Once you've filled out the form correctly, Coppermine will automatically log you in with the account you just created. Using Coppermine Coppermine is very powerful, but with that power comes complexity. Not only can you share your own images with Coppermine, but you can also allow users to upload images and share them with one another. For that reason, it supports user registration as well as the ability to assign users to groups, giving them access to particular albums and categories of albums. For example, you could create a group for your family members to upload pictures to a family photo album and another group for your friends in the garden club to share pictures of their rose gardens. The first step in testing Coppermine is to upload a picture. Before you can do that, you have to create an album to put it in. When you're logged in as an administrator, Coppermine provides an administrative toolbar that enables you to do things such as create albums, manage the list of users, and configure the application. Using the administrator's albums page, you can add a new album, as shown in Figure 21.13. Figure 21.13. Adding an album to Coppermine. [View full size image] file:///G|/1/0672328860/ch21lev1sec8.html (2 von 5) [19.12.2006 13:50:23] Coppermine As you can see from the figure, I'm adding an album called "Family Photos." To add the album, all I have to do is click on the Apply Modifications button. Once that's done, I'm taken to my new, empty photo album. From there I can click on the Upload File link in the navigation area and upload a file using an HTML form. Coppermine enables you to upload multiple files at once in order to save time, but in this case I'm just uploading one file. Once the file is uploaded, I can assign it to an album and enter a title, description, and keywords for it, as shown in Figure 21.14. Figure 21.14. Describing an image in Coppermine. [View full size image] file:///G|/1/0672328860/ch21lev1sec8.html (3 von 5) [19.12.2006 13:50:23] Coppermine The image I uploaded was actually much larger than it appears in the figure. That's why you must have ImageMagick or GD installed in order to use Coppermineit uses them to resize the images you upload. On this screen, I've assigned the image to the Family Photos album and have given it a name and description as well. Once I'm done with that, the image appears in the album I assigned it to. Once an image has been included in an album, users can view, rate, and comment on it. Aside from creating albums and uploading photos, you might also want to modify the configuration of Coppermine so that it works the way you want it to. There are a number of options that enable you to control the degree to which users are allowed to participate on your site. For example, if you don't want the general public commenting on your photos, you can disallow user registration and bar users from submitting anonymous comments. You can also change the appearance of your site, picking any of the themes that are installed by default, and changing the name and description of your gallery. In Figure 21.15, you can see what the configuration page of the site looks like once I've switched themes and updated my gallery's name and description. Figure 21.15. The Coppermine configuration page after a theme change. [View full size image] file:///G|/1/0672328860/ch21lev1sec8.html (4 von 5) [19.12.2006 13:50:23] Coppermine If none of the themes included with Coppermine suit your tastes, you can find more themes at the Coppermine website. You can also create themes of your own, just as you can for MediaWiki or WordPress. There's a lot more you can do with Coppermine; this was just a quick introduction to getting it installed and running. Fortunately, there's a detailed manual at the Coppermine website that you can delve into if you wind up using Coppermine on your own website. file:///G|/1/0672328860/ch21lev1sec8.html (5 von 5) [19.12.2006 13:50:23] Other Applications Other Applications This lesson provided a very brief tour of a few popular web applications that you can use to go beyond building websites made up of static HTML pages. Not only are there lots of other applications out there, but there are lots of other categories of applications out there. You can find guest books, shared calendars, discussion boards, tools for sharing bookmarks, and everything in between. Also, even though I focused on applications written in PHP, there are equivalents of these applications written for many other platforms as well. If you want to set up a wiki at work, and all your servers run Windows, you can use FlexWiki, which is written using ASP.NET. Its home page is http://www.flexwiki.com/ default.aspx. If you want a weblogging tool written using Java and JSP, you can use Roller, which can be found at http:// rollerweblogger.org/. Companies are always trying to bridge the gap between hosted applications that are very structured and applications you can download and manage yourself, which are generally more flexible. For example, a company called Ning ( http://www.ning.com) has built a hosted system for constructing your own applications. It is "hosted" in the sense that your applications reside on their servers and you don't have to worry about logging into the servers or managing them in any way. However, they provide their own programming language and database that you can use to build applications. Their tools are not as flexible as languages such as PHP or ASP.NET, but they can still be used to build a wide variety of applications. It remains to be seen whether Ning's concept takes off, but the overall trend in web application development continues to move toward giving people with limited programming skills more flexibility in the types of things they can deploy without writing applications on their own. file:///G|/1/0672328860/ch21lev1sec9.html [19.12.2006 13:50:23] . 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. == 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>. done with that, the image appears in the album I assigned it to. Once an image has been included in an album, users can view, rate, and comment on it. Aside from creating albums and uploading