Click here to Skip to main content
Click here to Skip to main content

StP Forum

, 17 Mar 2002
Rate this:
Please Sign up or sign in to vote.
ASP-based forum for your website.

Sample Image - stpforum.jpg

Introduction

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 Smile | :) 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*)

Features

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 Smile | :)

Files list

All files in forums may be used as includes to your main files. It is like a text inside your <BODY> tag.

  • 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.

Configuration

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.

Database options

First and main is a ConnString. You need to set it to your database connection string, like "DSN= MyDB" or DSN-less connection.

Look
  • HeadCellColor -background color for forum header
  • HeadFontColor -text color for forum header
  • CategoryCellColor - background color for category (TD tag)
  • 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
  • HighlightRows - True or 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).
Smilies
  • UseSmiles - Boolean (True/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: smile.gif|biggrin.gif|confused.gif
  • SmiliesTypes - text to replace with images. String with "|" delimiter between several types. Example: :)|:-D|:confused:
  • SmiliesDescriptions - short description for every smiley, will be shown as tooltip in the post form
Bad words
  • BadWordsFilter - Boolean, determines if use bad words filter or not. To use it set to True
  • BadWords - string with bad words and "|" as delimiter between them. No example here and you know why Smile | :)
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 BLOCKQUOTE tag
  • [color=*] - changed to <FONT color="*"> tag
  • [size=*] - font size, replaced with <FONT size="*">
  • [url=*]**[/url] - defines URL, replaces with <A href="*" target=_blank>**</A>
  • [mail=*]**[/mail] - same as URL, but adds mailto: to *
Session variables
  • 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
Other parameters
  • 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 Smile | :)

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 </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]", _
                                        "<FONT color=$1>$2</FONT>")

The "(.+)" 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? Smile | :)

P.S.

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 Smile | :)

Any bugs, suggestions, ideas and feature requests you can post here, or on my site or send them directly to my e-mail.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Philip Patrick
Team Leader Varonis
Israel Israel
I was born in small town Penza, Russia, in October 13th, 1975 yr. So my mother tongue is Russian. I finished the school there and learned in University, then I came to Israel and since then, I live there (or here *s*)
My profession is a C++ programmer under MS Windows platforms, but my hobby is Web development and ASP programming.
 
I started interesting in computers and programming somewere in 1990-1991 yrs., when my father brought home our first computer - Sinclair ZX Spectrum (he made it by himself). So I learned Basic and joined the Basic programmers club at my school (me and my friend were the only 2 guys from all school there, lol). After I finished the school (1992yr) I decided to continue my study at University and got specialization Operation Systems and Software Engineer. Although I still like my profession, but I always wanted something new, thus I learned HTML, Javascript and ASP which turned to be my hobby Smile | :)

Comments and Discussions

 
Generalmedia data transfer between filters Pinmemberbhanu_850911-Jan-08 2:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 18 Mar 2002
Article Copyright 2002 by Philip Patrick
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid