2. Component files of the forums

There are two directories to add to your foundation catalog -- include/forum and pages/forum. You must add a database table definition, as well as a database source file. You should add Variable support to the variable.txt database, and supporting metadata with help. Finally, you need to add the forum.tag file which contains the forum code.

If you build a foundation catalog from the latest Interchange source, all of these will be done already.

The files that are needed in the catalog directory:

        dbconf/default_db/forum.dbm
        dbconf/mysql/forum.mysql
        dbconf/pgsql/forum.pgsql
        include/forum/reply_form
        include/forum/submit_form
        pages/forum/reply.html
        pages/forum/display.html
        pages/forum/submit.html
        products/forum.txt

The files that are needed in the Interchange software directory:

        code/UserTag/forum.tag

Add the following lines to products/variable.txt (change | to TAB):

FORUM_ANON_NAME|Anonymous Coward|Forums
FORUM_PRODUCTS|1|Forums
FORUM_EMAIL_NOTIFY|sales@yourcompany.com|Forums

Add the following records to products/mv_metadata.asc (shown in key: value format, edit file to match with "te" or some other tool):

#
# This is a temporary file, automatically generated from the
# database file:
#
# /tmp/what.txt
#
# If you change anything in it, it will be converted back into the
# original format and will replace the original file.
#
code:variable::Variable::FORUM_EMAIL_NOTIFY
type:text
width:50
height:
field:
db:
name:
outboard:
options:
attribute:
label:Forum notify email
help:An email address to send copies of user comments on products.
lookup:
filter:
help_url:
pre_filter:
lookup_exclude:
prepend:
append:
display_filter:
default:
extended:
#
code:variable::Variable::FORUM_ANON_NAME
type:text
width:20
height:
field:
db:
name:
outboard:
options:
attribute:
label:Forum Anonymous Name
help:Name to use when a user posts anonymously to a forum
lookup:
filter:
help_url:
pre_filter:
lookup_exclude:
prepend:
append:
display_filter:
default:
extended:
#
code:variable::Variable::FORUM_PRODUCTS
type:yesno
width:
height:
field:
db:
name:
outboard:
options:
attribute:
label:Enable Product Forums
help:This enables user comments on products in the flypage.
lookup:
filter:
help_url:
pre_filter:
lookup_exclude:
prepend:
append:
display_filter:
default:
extended:

Add the following block to pages/flypage.html:

        [if variable FORUM_PRODUCTS]
          <tr>
                <td>
                        [forum top="[item-code]" display_page="forum/display" /]
                        <p>
                        [page href="forum/reply"
                                        form="
                                                product=1
                                                mv_arg=[item-code]
                                        "
                        ]Comment on this product.</A>
                        </p>
                </td>
          </tr>
        [/if]

This would normally go at the end of the table displaying the product, but you can place and edit to suit.

Again, all of this is provided if you have installed from the latest Interchange 4.9.4 or higher.