In this section, you'll see what is involved in building a bigger web application, as we take you through the coding for an online Forum. You may not want a Forum on your site, of course, but the project is well worth doing all the same. There are plenty of techniques here that can be carried over into your own pages, and hopefully you'll acquire some new coding skills. There are plenty of exercises to complete along the way, so it's not all theory!
This Forum, however, is not intended to be an application that you can simply upload to your own site, and get working straight away. It is purely for teaching purposes. All the files for this section can be found in the forum folder you downloaded. Before you start, it's a good idea to make a copy of this folder. That way, you won't be changing any of the original files. Copy the entire forum folder to the www directory on your server. You should then have the forum folder inside of your www folder.
If you double click the forum folder, you'll see all the files and scripts mentioned in this walkthrough. The database for this walkthrough can be found in the databases folder, and is called dbforum. This folder contains the database for this projects, and all the tables. Copy this folder the data folder of MySQL.
For Wampserver users this will be in the following location:
To check if everything is working, start your server and navigate to this address:
Or you can try this:
What you should see is the very basic forum in the link below:
The Basic Forum (Opens in a new window 80K).
Obviously, the HTML needs improving! But this is one of things you'll be changing, as we go along. You'll see where you can adapt the HTML, and how to add your own code.
But the basics of the forum in the image above are common to most forums: you have the forum sections as hyperlinks, and then additional information along side each link. In our forum, we'll see how to get the number of posts in a section, and how many people have replied to each post.
Once you have loaded the forum into your browser, play around with the it. Only the Microsoft Word section is working, so click this link. You'll then see this:
The Posts in the Forum (Opens in a new window 110K).
What you're looking at is all the Posts in the Microsoft Word section of the forum. Only members are allowed to Post on the forum, and you'll see the member name in the first column (Posted By). Only one Post has any replies - the first one at the bottom. Click this link, and you'll see a new screen:
The Replies to the Posts (Opens in a new window 125K).
Because there are 11 replies, they are split over 2 pages, with a link to each page. If you were logged in as a member, you'd see a different link at the bottom of the page, allowing you to reply to this Post. Try this for yourself. Click on the link that says "Login Here". You'll be taken to an area that asks you to enter a username and password. You can use any of the username/password combinations that you can find in your scripts/forum folder. Open up the text file called uandp.txt and you'll see them all in there.
Login with one of the username/password combinations, and you'll be allowed to Post topics in the Microsoft Word section, and Reply to them.
Now that you have a good idea of how the forum works, it time to get started. There's one important thing we need to do first: set up the database.