bf.forums | Object Reference | Express Edition
(For the most up-to-date version of this reference, please visit the bf.forums express webpage)
 
Property set/get methods
set/get_title()
set/get_description()
set/get_color1()
set/get_color2()
set/get_fontface()
 
Methods
load_forum()
show_forum()
show_composemessage()
show_viewmessage()
show()
show_forumlist()
new_forum()
edit_forum()
delete_forum()
post_message()
edit_message()
delete_message()
cleanup()
 

Property set/get method | _title()
Type:
set_title(String)
String get_title()

Description:  The title of the currently loaded forum.  This property gets set upon a successful call to load_forum().  You can write to this property, but the value gets overwritten if a subsequent call to load_forum() is made.  To make a permanent change to a forum's title, see the edit_forum() method.

Common usage (Jscript):
var myforumtitle = forumobj.get_title();
forumobj.set_title("My Forum");

Property set/get method  | _description()
Type:
set_description(String)
String get_description()

Description:  The description of the currently loaded forum.  This property gets set upon a successful call to load_forum().  You can write to this property, but the value gets overwritten if a subsequent call to load_forum() is made.  To make a permanent change to a forum's description, see the edit_forum() method.

Common usage (Jscript):
var myforumdesc = forumobj.get_description();
forumobj.set_description("This is the description of my forum");

Property set/get method | _color1()
Type:
set_color1(String)
String get_color1()

Description:  The HTML representation of the color of the odd numbered (1,3,5...) rows when displaying a forum.

Default value:  "#FFFFFF"

Common usage (Jscript):
forumobj.set_color1("#808080");
var color1 = forumobj.get_color1();

Property set/get method | _color2()
Type:
set_color2(String)
String get_color2()

Description:  The HTML representation of the color of the even numbered (2,4,6...) rows when displaying a forum.

Default value:  "#EDEDF3"

Common usage (Jscript):
forumobj.set_color2("#808080");
var color2 = forumobj.get_color2();

Property set/get method | _fontface()
Type:
set_fontface(String)
String get_fontface()

Description:  The HTML representation of the font face of the text used when displaying the form and its controls.

Default value:  "verdana,arial"

Common usage (Jscript):
forumobj.set_fontface("arial");
var fontface = forumobj.get_fontface();


Method | load_forum(forumid, homeurl, showtitlebar, color1, color2)
Description:  Loads a forum into the object's memory.  This function is required before any of the show_xxx() methods are called.

forumid (required, Integer):  ID of the forum that should be loaded
homeurl (required, String): Relative path to page that is the main display for the forum
showtitlebar (optional, bool): BOOLEAN value that indicated whether or not the titlebar should be displayed on the forum.  Default value is true (on).
color1 (optional, String): The HTML representation of the color of the odd numbered (1,3,5...) rows when displaying a forum.  Supplying this parameter will have the same effect as setting the color1 property after calling load_forum().  Default value is "#C0C0C0".
color2 (optional, String):  The HTML representation of the color of the even numbered (2,4,6...) rows when displaying a forum.  Supplying this parameter will have the same effect as setting the color2 property after calling load_forum().  Default value is "#C0C0C0".

Common usage (Jscript ):
forumobj.load_forum(24, "index.asp", true, "#808080", "#FFFFFF");

Method | show_forum(width, start, maxmsgs)
Description:  Use this method to output a forum to a webpage.  The method will draw, or "show," the loaded forum in standard HTML to be rendered by any browser.  Note that a successful call to "load_forum()" must be made before "show_forum()" can be called.

width (required, String):  String representation of an HTML usable width (i.e. "75%", or "550") for the forum.
start (optional, Integer): 1-based Index of first top level message to display.  For instance, if your pages are designed to show 10 top level messages per page, and you wish to display the second page, the "start" value would be 10.  The default is to start displaying with the first top level message in this forum.
maxmsgs (optional, Integer): Maximum number of top level messages to display.  The default value for maxmsgs is 30.

Common usages (Jscript ):
forumobj.show_forum("90%");
forumobj.show_forum("500", 30);
forumobj.show_forum("50%", 20, 10);

Method | show_composemessage(parentid)
Description:  Use this method to output a form to be used to compose a message for the loaded forum.  This method will draw, or "show," a form that is ready to be used in standard HTML to be rendered by any browser.  Note that a successful call to "load_forum()" must be made before "show_composemessage" can be called.

If a parentid is supplied, this method will pre-populate the form with the parent message just below a divider ("----------") and space for the user to add their own message.

You are free to create your own forms for users to compose messages for a particular forum, just make sure all the expected form elements are submitted to the receiving page.

parentid (optional, Integer):  ID of a currently existing message, if the new message that is to be composed is a REPLY to a currently existing message.  The default value indicates that the user will be submitting a new top level message (not a reply to any other existing messages)

Common usages (Jscript ):
forumobj.show_composemessage();
forumobj.show_composemessage(956);

Method | show_viewmessage(msgid, width)
Description:  Use this method to output a forum message from the database  This method will draw, or "show," a forum message that is ready to be used in standard HTML to be rendered by any browser.

msgid (required, Integer):  ID of the forum message that should be loaded
width (optional, String): String representation of an HTML usable width (i.e. "75%", or "550") for the forum message output.

Common usages (Jscript):
forumobj.show_viewmessage(956);
forumobj.show_viewmessage(956, "100%");

Method | show(width, action, id, start, max)
Description:  Based on the value of the "action" parameter, this method outputs the forum, a compose message form, or an individual message display.  Note that a successful call to "load_forum()" must be made before "show()" can be called.

Tip: Although this function is flexible and can be used in many different ways, please see the supplied example file "forum.asp" for an example of how this function is intended to be used -- Using parameters supplied in the URL.

The "show()" method works like this:

if( action == "nothing" )
  show_forum( width, start, max );
else if( action == "view" )
  show_viewmessage( id, width );
else if( action == "post" )
  show_composemessage( id );
else
  show_forum( width, start, max );

width (optional, String):  String representation of an HTML usable width (i.e. "75%", or "550") for the output.
action (optional, String): String representing the action to take.  Actions that are understood include "view", "post", and "nothing".  See above.  Note that a successful call to "load_forum()" must be made before "show()" can be called, and all actions taken are based on the currently loaded forum.
id (optional, Integer): If the action parameter is "view," this "id" parameter should indicate the message ID that which should be displayed.  If the action parameter is "post," this "id" parameter should indicate the parent ID (or the ID to which the new message will be a reply), if there is one.  If the action parameter is not supplied, or equal to "nothing," this "id" parameter is ignored.
start (optional, Integer): If the action parameter is "nothing" or not supplied, the start parameter is passed to the show_forum() method as the start value.  This parameter is ignored in all other cases.
max (optional, Integer):  If the action parameter is "nothing" or not supplied, the max parameter is passed to the show_forum() method as the max value.  This parameter is ignored in all other cases.

Common usage (Jscript):
forumobj.show();
forumobj.show("75%");
forumobj.show("500", "post");
forumobj.show("500", "post", 349);
forumobj.show("100%", "view");
forumobj.show("100%", "nothing", 0, 30, 10);
forumobj.show("90%", action, id, start, 15);
       <--  From example file, forum.asp

Method | show_forumlist(width, order, viewpage, editpage)
Description:  This method outputs a complete list of the forums currently stored in the forums database.  This method can also be used to provide users access to the individual forums, and/or their respective editpage (page designed to edit the forum properties).

width (optional, String):  String representation of an HTML usable width (i.e. "75%", or "550") for the output.  Default is "100%"
order (optional, Integer): Ignored in the express version of bf.forums, this parameter is used to control the order that which the forums are displayed.
viewpage (optional, String): A relative or absolute path to a page developed to view a particular forum.  In the example implementation supplied with bf.forums express, this would be, with a relative path, "forums.asp"
viewpage (optional, String): A relative or absolute path to a page developed to edit a particular forum.  In the example implementation supplied with bf.forums express, this would be, with a relative path, "editforum.asp"

Common usage (Jscript ):
forumobj.show_forumlist();
forumobj.show_forumlist("50%");
forumobj.show_forumlist("100%", 0, "forum.asp");
forumobj.show_forumlist("100%", 0, "myforums/forum.asp", "../admin/editforum.asp");

Method | new_forum(title, description)
Description:  Creates and inserts a new forum into the database.

Returns:
If the forum creation was successful, the ID of the newly created forum will be returned.  0 (zero) will be returned otherwise.

title (required, String):  Title of the new forum.
description (required, String): Description of the new forum.  If you do not wish to have a description associated with this forum, use a zero-length string ("")for this parameter.

Common usage (Jscript ):
var newid = forumobj.new_forum("My new forum", "");
var newid = forumobj.new_forum("My new forum", "My description here.");

Method | edit_forum(forumid, title, description)
Description:  Updates the specified forum's title and description in the database.

Returns:
true if thought to be successful, false otherwise.

forumid (required, Integer):  ID of the forum that should be loaded
title (required, String):  New title of the forum.
description (required, String): New description of the forum.  If you do not wish to have a description associated with this forum, use a zero-length string ("")for this parameter.

Common usage (Jscript ):
var success = forumobj.edit_forum(96, "My favorite forum", "");
var success = forumobj.edit_forum(96, "Discussions", "My description here.");

Method | delete_forum(forumid)
Description:  Deletes the specified forum from the database.

Returns:
true if thought to be successful, false otherwise.

forumid (required, Integer):  ID of the forum that should be deleted.

Common usage (Jscript ):
var success = forumobj.delete_forum(3645);

Method | post_message(parentid, grandparentid, subject, text, author)
Description:  Inserts a forum message in the database associated with the loaded forum.  Note that a successful call to "load_forum()" must be made before "post_message()" can be called.

parentid (required, Integer):  If the message to be posted is a reply to another message, the ID of the other message should be supplied here.  Use 0 (zero) if this is a top level message (not a reply).
grandparentid (required, Integer): Ignored in the express version of bf.forums.  The value of 0 (zero) is recommended.
subject (required, String): String representing the "Subject" of the new message.
text (required, String): String representing the body "Text" of the new message.
author (required, String): String representing the "Author" of the new message.

Common usage (Jscript):

forumobj.post_message(34, 0, "My Message", "This is my message...", "John");

Method | edit_message(messageid, author, subject, text)
Description:  Edits an existing message in the database.

messageid (required, Integer):  ID of the message to edit.
author (required, String): String representing the new "Author" of the message.
subject (required, String): String representing the new "Subject" of the message.
text (required, String): String representing the body new "Text" of the message.

Common usage (Jscript ):
forumobj.edit_message(634, "A. Smith", "Message from Smith", "Message here...");

Method | delete_message(messageid)
Description:  Deletes the specified message from the database.

messageid (required, Integer):  ID of the message that should be deleted.

Common usage (Jscript ):
forumobj.delete_message(96);

Method | cleanup()
Description:  Cleans up an memory usage during the use of bf.forums.  This function should be called at the end of every script that uses bf.forums.  Not calling this function at the end of every script that uses bf.forums could lead to a memory leak, and eventual locking of your web server

Common usage (Jscript ):
forumobj.cleanup();
Copyright 1999 - 2004, bf.collaboration Inc.  All rights reserverd.