HTML Goodies: WWW Board
Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js
[Upload and Set Modifications]
Late in 1998, The HTML Goodies Discussion Groups went up. The purpose of the groups was two-fold. First was to give HTML newbies and those in the know a method of getting together to ask and answer questions. The second was to free up some of my time. I would literally sit and answer email for two hours at a pop. I was burning out, let me tell you.
The discussion groups were created with my new favorite method of creating difficult programming. We paid someone to do it. The groups are PERL CGI driven and work in a "real-time" mode in that as soon as you post, you can refresh and your post or response shows up.
As could be expected, the moment my groups went up, people began writing and posting regarding how they could get their own discussion group. My pat answer that you pay someone to do it for you didn't go over very well.
I ran into Matt's Script Archive. It's a great site. He doesn't offer a great number of scripts, but the ones he does have work like a dream. I have three or four running on my account at school.
One of his best scripts is what he calls the WWWBoard. It's a discussion group that acts just like the HTML Goodies groups. I have it running on my school system and it has yet to give me a problem. In fact, I got it to run the first time I installed it. That's rare for a PERL driven anything.
So I wrote to Matt himself and asked if I could do a tutorial on the board. He agreed with one stipulation, I can't distribute the files. You do have to go to Matt's site to get them. So, let's start with that. Here's the address:
Once there, you'll have your choice of grabbing the files one by one or in a download packet. My suggestion is to grab that packet. It's so much easier. You'll have your choice of:
- wwwboard.tar.gz (16K)
- wwwboard.zip (18.6K)
- wwwboard.tar.Z (26.6K)
- wwwboard.tar (82K)
I'm a big ZIP guy. I always grab the zip. Once you open that puppy, here are the files you'll find and their descriptions (Taken from Matt's page):
Special information about the 2.1 ALPHA 2 release.
Includes installation instructions and a detailed description of how to set it up to work on your server.
The README file for WWWAdmin.
The main WWWBoard perl script which runs everything.
The admin perl script which helps you maintain WWWBoard.
The html file with the post form and entry spots. All message links will be posted here.
A Frequently Asked Questions HTML file which you can post for your users.
The data file which keeps an incremented log of numbers for messages.
A password file for WWWAdmin.
It's best for anyone to actually see what he or she is shooting to make before trying it out. I actually grabbed some screen captures of mine once I got it running. It's a little big to show the detail so give it a moment to come in. You'll note that it's pretty barren at the moment. When you first install it, there are no images, so you'll need to gussy it up a bit yourself.
Matt himself offers a working demo but it was down the last couple of times I went in, but try it for yourself.
You'll note that you get a bunch of files in your download packet, but don't fret. You really only have to alter two of them: the wwwboard.pl and wwwboard.html files. Let's start with the wwwboard.pl.
First off, remember that you're dealing with a PERL script here. You first need to make a point of saving a backup of the original file. I always forget to do that and end up having to download the file again to get a new clean copy.
.pl or .cgi?
The file itself is given to you with the extension .pl. That means PERL. Your server may not allow you to use that extension. Mine doesn't. I had to change the extension of the file to .cgi. If you have to do the same, resave the file with that new extension. Do not just go in and alter the extension by right clicking and choosing rename. That can mess up the script. Resave with the new name and work on that resaved file.
Once you have that file saved in the correct format, you need to alter it so that it will recognize all of the paths and files on your server. Here's the text of the script that will open up in a new window so that you can follow along as I go over the parts you need to change.
You Need A Directory
This tripped me up. At this point you need to decide what you will name a directory where all of the information compiled by this script will be held. The basic concept is that you will set aside a directory to hold your files and then put a subdirectory in that one where the messages will be held. So decide on that right now. I went with the suggestion of the author, I named my directory /messages/.
I named the directory where the script's files will be held /wwwboard/ and inside that directory, stuck a subdirectory called /messages/. That was the suggestion of the author, so that's what I did. The directory /wwwboard/ will hold the files that run the program, and the subdirectory /messages/ will be where the program holds the messages posted. Get it?
For the purposes of this tutorial, I'll assume you did the same. Now, throughout the rest of this tutorial use just the path to the directory /wwwboard/ with a leading slash to represent the domain (/directory/directory/wwwboard). Do not use the full URL (http://...)
For the rest of this tutorial I'll use "/directory/directory/wwwboard" as the representation of the path you'll use.
No, that's not a typo. Notice the first line of the PERL script: "#!/usr/local/bin/perl" .
That is the path to PERL on your server. What the author has there is the most common path on most servers, but it may not be the same on your server. How do you find out? Telnet into your system and at the prompt, type: "whereis perl".
The path will be returned. If it is the same as what is offered in the script, you're good to go. If it's different, you have to change it.
Define Those Variables!
This is the part we're most concerned with:
# Define Variables
$basedir = "/path/to/wwwboard";
$baseurl = "http://your.host.xxx/wwwboard";
$cgi_url = "http://your.host.xxx/cgi-bin/wwwboard.pl";
$mesgdir = "messages";
$datafile = "data.txt";
$mesgfile = "wwwboard.html";
$faqfile = "faq.html";
$ext = "html";
$title = "WWWBoard Version 2.0 Test";
The script is set up nicely in that you only need to alter each path once. That path is then put to a variable and is used in the script later. Otherwise, you'd need to alter it every time it appeared. That would be a pain to say the least.
This is the absolute path (all directories - no tildes) to your wwwboard directory. Again, it's up to you whether to use the full URL or the leading slash. If you do not know the absolute path to your directory, contact your service provider or telnet in and type "pwd" at the prompt. The return will be the absolute path.
This is the URL that someone would put in a browser to reach your wwwboard directory. This must be the full http:// format.
This is the URL path to the wwwboard.pl file. Use the /directory/directory/cgi-bin/wwwboard.pl format. You must have this correct because it is used in responses.
This is the name of the directory where all of your messages will be kept. If you named it messages, you don't need to touch this. You only need the name of the file here because it will be added to the end of the address you put in the $basedir just above. How simple is that?
This is a text file where all of the messages will be kept. You only need the name of the file here because it will be added to the end of the address you put in the $basedir just above.
This is the name of the HTML file (which you got in the packet). Right now it's named wwwboard.html. You'll most likely want to amend it to be index.html. I did. If you do, make sure you change that here.
This is the faq.html that you received in the packet. Again, this will be added to the end of the $baseurl so there is no need to put in the full URL
This is the extension that will be added to each of the files created by the script. Keep it html until you have a very, very good reason not to.
This is the title that will appear on the responses and posts. You may want to make it a little more exciting than what is currently there.
Basically You're Done
This is the farthest I went with the script. Yes, there are other things you can alter and you can read about them in the Readme file. I didn't touch a thing from this point on so I'm not going to tell you to touch anything either.
You need to make just a couple little changes to this file, then we can upload and begin posting. Here's the file (it will render so View Source is in order).
Obviously you'll need to change out some of the HTML text like the title and the H1 text so it will be representative of your site. That you can do on your own.
The only coding concern you'll have to get this thing to work is to make sure that the main form command is pointing towards the wwwboard.pl (or cgi).
About 20 lines down in the code, you'll see this:
That's the line you're worried about. Alter it so that the action points at the script you just took so much time altering. Remember! That script will be inside your cgi-bin. (I always forget that for some reason).
Save that file. Let's upload and set modifications.
Upload and Set Modifications
The wwwboard.pl script goes into your cgi-bin. That much you probably could have guessed. Set it's modification to 755 like so:
Now take these files:
- wwwboard.html (you may have changed this to index.html)
...and put them all into the /wwwboard/ directory (or into wherever you stated they would be found when you altered the script). Do not put them inside the /messages/ subdirectory. They go inside the /wwwboard/ directory.
The /messages/ directory should be set to a modification of 777 following the same format as above.
The faq.html and the wwwboard.html should be set to a modification of 744 so everyone can read it.
The data.txt file should be set to a modification of 777 so it can be written to.
You should now be able to log into the /wwwboard/ directory and open the wwwboard.html (maybe now index.html) file and begin posting. Again, I got mine to work on the first shot.
As you might have guessed from the download packets, there are also administrative items available to you. I never played with them, so I don't feel as if I can write on them. So go grab the files, alter them, add them to your site and watch the number of posts grow. It's fun.
[Upload and Set Modifications]