Whether you call them message boards, forums, or in our case, Discussions, interaction between members of a site is one of the most important aspects of keeping your audience interested. And with our API, it has never been easier to get the conversation started.

The following getContents can simply be dropped into your site to provide a foundation to work from. Tweak the formatting, add or remove a tag using the Discussions API as a reference, style it, and you're done!

To allow for formatting in comments, the Textile markup language has been integrated into the Discussions system. Raw HTML is not allowed -- so as not to allow members the ability to hijack the design or introduce security vulnerabilities -- and will be rendered as normal text within the comment. For a primer in the language of Textile, take a look at the quick reference or more thorough complete reference.

This getContent can be placed in its own file, but normally appears after the getContent to display the discussions in mcms_disc_discussions.php, which is accessed through the URL http://www.mysite.com/discussions/{board slug}/{category slug}/.

This getContent should be placed in a file named mcms_disc_comments.php, which is accessed through the URL http://www.mysite.com/discussions/{board slug}/{category slug}/{discussion slug}/{discussion ID}/. The .htaccess rule:

This getContent can be placed in its own file, but normally appears after the getContent to display the comments in mcms_disc_comments.php, which is accessed through the URL http://www.mysite.com/discussions/{board slug}/{category slug}/{discussion slug}/{discussion ID}/.

This getContent should be placed in a file named mcms_disc_edit_comment.php, which is accessed through the URL http://www.mysite.com/discussions/{board slug}/{category slug}/{discussion slug}/{discussion ID}/edit/{comment ID}/. The .htaccess rule:

This getContent can be placed in its own file, but normally appears after the getContent to edit the specified comment in mcms_disc_edit_comment.php, which is accessed through the URL http://www.mysite.com/discussions/{board slug}/{category slug}/{discussion slug}/{discussion ID}/edit/{comment ID}/.

When a request is made to post a new discussion or edit a comment, for example, the system 1) attempts to complete the action and 2) redirects the member to an appropriate URL. Attached to the query string of this URL is a sysmsgid parameter with an integer value corresponding to the result (whether success or failure) of the request. They are:

$systemMessages = array( 1 => 'The discussion could not be added at this time.', 2 => 'The comment could not be added at this time.', 3 => 'Please enter a discussion title to submit.', 4 => 'Please enter a comment to submit.', 5 => 'The integrity of your action could not be verified.', 6 => 'The discussion was successfully added.', 7 => 'The comment was successfully added.', 8 => 'The comment could not be edited at this time.', 9 => 'The comment was successfully edited.', 10 => 'The comment could not be deleted at this time.', 11 => 'The comment was successfully deleted.', 12 => 'The discussion could not be deleted at this time.', 13 => 'The discussion was successfully deleted.', 14 => 'The discussion could not be edited at this time.', 15 => 'The discussion was successfully edited.' );

To display the system messages as helpful feedback, include the above array along with the following PHP code in each mcms_disc_*.php file: