I was looking for an ASP forum to add to my site and found some. One I didn't like the look, another was hard to insert into my site (changes almost on every page needed), so I decided to make my own forum. I surfed the web to see different forums, on different scripting languages, then made a list of basic features I wanted to see in my forums. Remember this is not a message board, like the one you see on CodeProject, it is a forum. Though I am still unsure about differences On the picture above you can see a screenshot of the forum. If you want to see a live demo, go look on my site.
Ok, let me introduce you the features in the forum (I called it StP Forum, StP is a short form of my nickname, full is StPatrick *s*)
Below are the list of main features of StP Forum
- Members system (also tracking total posts by every member)
- Anonymous posts (can be turned on/off in configuration file)
- Moderators (currently only one moderator per forum). They can lock/unlock topics in their forums, delete posts.
- Smilies replaced with images
- Support for pseudo-code ([b], [i], etc...)
- Forum search
- Bad words filter
More features will be added in future. If you have some ideas, let me know
All files in forums may be used as includes to your main files. It is like a text inside your
- config.asp - Configuration file
- admin_inc.asp - Administration file
- forum_inc.asp - Main file for displaying forums and topics
- login_inc.asp - login form and code
- mail_inc.asp - form for e-mailing to members
- members_inc.asp - members list and particular member info page
- post_inc.asp - form for making a new topic, post or edit existing.
- ppreview.asp - standalone file for previewing your post before submitting it
- profile_inc.asp - form used for changing profile and registering
- search_inc.asp - search form and search results page
The typical use of all the files with "_inc" is to include them in your own files, using SSI (server-side includes) in the place you want them to be displayed. This gives you an option to make your pages like you want, with your background, formatting, additional text or whatever. If you want them as is, just make it with empty ASP pages and include the proper file inside your
BODY tag. Remember to configure your forum. At least a database connection string need to be changed in order for the forum to work.
To configure your forums, use config.asp file. Inside it you will find several variables that you can change. Although I think they are describing themselves very well, I will run through them here.
First and main is a
ConnString. You need to set it to your database connection string, like "DSN= MyDB" or DSN-less connection.
HeadCellColor -background color for forum header
HeadFontColor -text color for forum header
CategoryCellColor - background color for category (
CategoryFontColor - category text color
ForumCellColor - background color for the rest of forum. Used as background for replies also
ForumCellAltColor - alternative background color for forum. Used as background for topic text and rows highlighting (if enabled)
ForumFontColor - text color
False. Determines if highlight rows on mouse over or not.
Files and directories
- ImagesDir - folder where all images stored. Leave blank if the images are in same directory as files. The directory can be relative to main forum file or absolute. The final path to image is calculated as follows: ImagesDir + ImageName.
- ForumFile - main forum file name, where the forum_inc.asp is included
- MembersFile, AdminFile, EmailFile, PostFile, LoginFile, ProfileFile, SearchFile - file names for members, administration, e-mail form, new topic/post, login form, profile/registration, search, where corresponding files included. These are not include files names, but yours.
- NewTopicImage, ReplyImage, LoginImage, RegisterImage, ProfileImage, SearchImage - images for corresponding links, as seen from their names. Can be set to empty string (""). In this case text links will be used
- MessageImages - string with so-called message images ("|" as delimiter). When someone makes a post, he can choose an image to be shown near its topic (or without any image).
UseSmiles - Boolean (
False), determines if change smilies to images on display or not. If you set to
False, other smilies parameters are irrelevant
SmiliesImages - images (files names) for smilies. This is a string with "|" as delimiter between different files. For example:
SmiliesTypes - text to replace with images. String with "|" delimiter between several types. Example:
SmiliesDescriptions - short description for every smiley, will be shown as tooltip in the post form
BadWordsFilter - Boolean, determines if use bad words filter or not. To use it set to
BadWords - string with bad words and "|" as delimiter between them. No example here and you know why
HTML and Pseudo-code
AllowHTMLLevel - level of HTML. 0 means all HTML is stripped from the post (change all open and closing brackets (<>) to their HTML form). 1 means only several tags are restricted, see
RestrictedTags. 2 - All HTML is available and displayed as is.
RestrictedTags - if
AllowHTMLLevel is set to 1, the tags from this string ("|" as delimiter) are stripped from post. Example: "SCRIPT|IFRAME|EMBED|FRAME"
AllowPseudoCode - Boolean, tells if pseudo-code is allowed in the forums. If
False, all pseudo-code will be displayed as is.
Pseudo-code supported by current version of forums:
- [b] - bold text
- [i] - italic text
- [u] - underline text
- [s] - strike out text
- [center], [right] - text is centered/right aligned
- [quote] - changed to
- [color=*] - changed to
<FONT color="*"> tag
- [size=*] - font size, replaced with
- [url=*]**[/url] - defines URL, replaces with
<A href="*" target=_blank>**</A>
- [mail=*]**[/mail] - same as URL, but adds
mailto: to *
USER_LEVEL - set to name of session variable where the member's level will be stored.
USER_NAME - name of session variable with member's name
ForumName - name of your forums. Don't set to empty string, as it is used for backward navigation (from topic to forums list)
AllowAnonymous - Boolean. Tells if anonymous posts are allowed or user has to have an account
AnonymousUserName - If anonymous post was made, when displaying it, this will show below the person's name.
You will notice a small
STYLE tag at the top of the configuration file. The
BLOCKQUOTE tag is defined and also a class
SmartLink, which represents the topic/forum's names. When new post was made in some forum, the link changes and user will see that the forum/topic has new posts. By default it is set to bold for new topics and regular for forums/topics without new posts. You can change it to different colors for example.
Also there are many other things you can see in the configuration file. Like fields ordinal numbers for example. Do not change it unless you know what you are doing. Most of the database operations are made with ordinal numbers of fields instead of their names to increase database access speed. But in several places not, so it is not a guide to start changing fields names in your tables
And another thing you may want to change is how e-mail is sent. Look at the end of configuration file, you will see a small class named
MailClient. By default
CDO.Message is used to send e-mails. You may want to use something else, like ASPMail or whatever. Just change the
progID and be sure that your component has same methods and parameters.
Quick guide to changing pseudo-code
If you want to add a new pseudo-code and are familiar with regular expressions, you can do it easily. Look in the configuration file for a function named
FormatText. You will see several lines that looks the same, for example:
retval = ReplacePCode(retval, "", "", "<B>$1</B>")
So what it means? This is a simple replacement. [b] and [/b] will be replaced with
</B> and the text between them will be placed instead of
$1. Nothing new here, it is just a simplified form of regular expression.
Now about more complex things, like [color] code. Look at the line where it is defined:
retval = ReplacePCode(retval, "[color=(.+)]", "[/color]", _
(.+)" means at least one ANY character should be present in this place and the text (color here) will be placed instead of
$1 in second parameter. All other text, between the tags will replace
$2 in second parameter.
It can look complicated for someone who hasn't used regular expressions before, but you have to start somewhere, not?
If you are gonna use this forum on your own web-site, please leave the link to mine at the bottom of the forum table, it won't bother you too much
Any bugs, suggestions, ideas and feature requests you can post here, or on my site or send them directly to my e-mail.