Interchange + Forum/Blog HOWTO ============================== ic_howto_forum.1.5 (Draft) 1. Introduction =============== 1.1. Preamble ------------- Copyright 2002-2004 Mike Heins and Michael Wilk . Freely redistributable under terms of the GNU General Public License. 1.2. Purpose ------------ The purpose of this document is to expose how to use Interchange 5.0's forum and blog capability, enabled with the [forum ...] tag and a few ancilliary files. 1.3. Audience ------------- Anyone who is using an Interchange catalog. This is not rocket science. 1.4. Contact the authors ------------------------ If you find any spelling errors, technical slip-ups, mistakes, subliminal messages, or if you wish to send feedback, critique, remarks, comments, or if you wish to contribute examples, instructions for alternative platforms, chapters, or other material, please do so. The preferred method of submitting changes is in the form of a context diff against the SDF source file (ic_howto_forum.sdf). Please address your correspondence to: Michael Wilk mwilk@steppenwolf.com Mike Heins mike.heins@perusion.net 1.5. What it does ----------------- Interchange forums allow your customers to comment on your products, or allow you to sponsor discussion threads on an interchange catalog. They maintain their content in a single database table named forum. 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] [forum top="[item-code]" display_page="forum/display" /]

[page href="forum/reply" form=" product=1 mv_arg=[item-code] " ]Comment on this product.

[/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. 3. The [forum] ITL Tag ====================== The [forum] tag is what provides the capability. It uses the forum table and follows tree-like threads in that table. It has one required parameter, top. That gives the id of the message that is the top of the thread to display. This is a complete forum display for a product: [forum top="[item-code]" /] You will see something like that in the snip from pages/flypage.html above. You can pass many more parameters to the [forum] tag. Some of them are: display-page By default, the [forum ...] tag uses the current page to link to to re-display the forum at another level. Normally this works fine, but on a product flypage it will not work. You must pass in a different page. [forum top="[item-code]" display-page="forum/display" /] show-level By default, [forum] only displays the text of top-level replies to the current thread. If you want to display more levels, set the show-level parameter to 1 or higher: [forum top="[data session arg]" show-level=3 /] The above will show the first four levels of replies, with links to any further down the tree. scrub-score If you want to moderate certain comments so that their text won't be shown, you can set the scrub-score parameter to -1 and then set the score field in the message's database record to -1. By default, it is linked to with a message: One message beneath your threshold If you want to totally disable the appearance of the link and message, set the scrub-template to something: [forum top=THREAD scrub-score="-1" scrub-template="" /] show-score By default, if a message has a score of two or higher, it's text will be shown no matter what level of display it is on. You can set that threshold with this paramter. template You can set the template that displays replies with this parameter. You can also pass this as the container text for the [forum] tag, i.e.: [forum top="[data session arg]"]
{SUBJECT} by {USERINFO} on {DATE} [ Reply ]
{COMMENT}
[/forum] See pages/forum/display.html for an example. header-template You can set the header template that displays the top-level message with this parameter. See pages/forum/display.html for an example. link-template You can set the template that displays the links to messages that are not shown with this parameter. See pages/forum/display.html for an example. scrub-template The template for a message that has a score lower than scrub-score. See pages/forum/display.html for an example. threshold-message The message displayed in the default scrub-template when a message is scrubbed. If you set the scrub-template yourself, it is ignored. display-page The page linked to with {DISPLAY_URL}. Default is the current page. See Templating below. reply-page The page linked to with {REPLY_URL}. Default is forum/reply.html. See Templating below. submit-page The page linked to with {SUBMIT_URL}. Default is forum/submit.html. See Templating below. date-format The format for the date provided with {DATE}. Default is %B %e, %Y @%H:%M, which provides a date like October 5, 2002 @21:19. 4. Templating ============= All of the [forum] display mechanisms are templated. You can pass four templates -- template, header-template, link-template, and scrub-template. They use the substitution style found in Interchange's attr-list ITL tag. The following values are available for templating: ADDITIONAL Additional text normally only used at the top level COMMENT Text of the message CREATED Created date in ISO format DATE Date the comment was made DISPLAY_URL URL to display the forum with a new starting point FORUM_APPEND End indent tags for item (automatic, don't use) FORUM_PREPEND Begin indent