banner.jpg
Web Development and Tools Powered by WebSellerTM

 

Home

Tips
  Umlauts/UTF-8
  Normalization
  OemToAnsi
  MySQL Import
  Site Search
  City Desk
  DynDNS
  MXLookup
  SPAM

SDT

Support
  Downloads
  Contact Us

Impressum

German

RSS Feed

Site search:

Web Search

Made with CityDesk


Forumware

By Uwe Holz
Last Update: Monday, August 04, 2003

More information about WebSeller Online Shop and the appropriate download site can be found at http://www.webseller.de.

A discussion board for exchanging opinion and know how is a key feature of good and supportive web sites. When I thought about how to implement it I end up with the idea of using WebSeller. And guess what, it works! No limitation, no runtime fees. The license free version of WebSeller does the job perfectly. The following article describes the solution. 

MySQL will be used as database , what else <g>. It is, along with the WebSeller (Standard Edition) available for all server platforms. Content of the discussion forum can be maintained by following tables:

  • Table topic for discussion topics
  • Table message for individual messages

Table structures

Table structures look like this:

CREATE TABLE topic (
  TOPIC int(10) unsigned NOT NULL auto_increment,
  CAPTION char(80) NOT NULL,
  POST_DATE bigint(20) NOT NULL default 0,
  LANGUAGE enum('ger','eng') NOT NULL default 'ger',
 PRIMARY KEY (TOPIC));

CREATE TABLE message (
  MESSAGE int(10) unsigned NOT NULL auto_increment,
  BODY text NOT NULL,
  TOPIC int(10) unsigned NOT NULL default 0,
  POST_DATE bigint(20) NOT NULL default 0,
  AUTOR varchar(64) NOT NULL,
  MAILTO varchar(64) NOT NULL,
 PRIMARY KEY (MESSAGE));

Relation between both tables is established by column TOPIC.  

WebSeller Configuration

A simple CGI based forum requires at least eight different functions (CGI scripts):

  • DEFAULT - Displays all topics
  • RECENT_TOPICS - Displays most recent topics
  • VIEW_TOPIC - Displays all messages of selected topic
  • REPLY_TOPIC - Displays the input form for a topic reply message
  • NEW_TOPIC - Displays the input form for a new topic message
  • SAVE_TOPIC - Saves a message
  • SAVE_NEW_TOPIC - Saves a new topic message
  • SEARCH - Forum search

WebSeller has the capability to define those functions, therefore you don't really have to write them by yourself. You just have to create appropriate entries in configuration file webseller.ini. Each entry has following arguments:

  • Response - Html template used to generate the HTTP response entity.
  • Action - Webseller base function called to generate the response (Link, TableUpdate, Login, SetLanguage ...).
  • Select - SQL statement to create the data for generating the response.
  • Id - Id to keep track of the session (user).

Functions DEFAULT and  RECENT_TOPICS could be defined as follows:

[SCRIPTS]
DEFAULT=action=Link&response=forumview.html&ID=-ID-&select=topics
RECENT_TOPICS=action=Link&response=recentview.html&ID=-ID-&select=alltopics

The actual Select statements (topics and alltopics) are defined in a separate section in order to avoid URL length violation:

[SELECT]
...
TOPICS=SELECT * FROM topic WHERE LANGUAGE='-LANGUAGE-' \
    ORDER BY POST_DATE DESC
ALLTOPICS=SELECT * FROM topic ORDER BY POST_DATE DESC

The exact function definitions can be found in the configuration file contained in the download archive.

Link to the forum

The forum entry link should be defined by the following simple CGI call:

/cgi-bin/webseller.cgi     

If no arguments are specified WebSeller internally calls the function defined by DEFAULT key. If you want to separate messages by language (like implemented at current web site) the entry links will have to look like this:

  • Link to the English Forum:
    /cgi-bin/webseller.cgi?action=SetLanguage&newlanguage=eng&location=DEFAULT
  • Link to the German Forum:
    /cgi-bin/webseller.cgi?action=SetLanguage&newlanguage=ger&location=DEFAULT

Sample files

All files used to implement the discussion board at current website are part of download archive  forum.zip. Please adjust fictive value mydomain.com (used to define email address, mails server and home page) to your environment and use WebSeller Version 3.1.104 (or above) in order to implement your own web forum.

Needless to mention that forum data maintenance is implemented by SqlDBU. You can of course use any other MySQL data manipulation tool.