Summary: Simple and styled forum
Status: Stable
Version: 2019-06-02
Prerequisites: pmwiki-2.1
Categories: CMS, PHP7
Users: +1 (View / Edit)


How do I create a simple styled forum?


I have stopped development for this commentbox based forum, all my efforts go into the much advanced FoxForum. - HansB November 08, 2007, at 06:11 PM

unpack as necessary, and copy files to the cookbook directory
CAUTION: If you are already including commentbox.php, remove it, since this recipe includes it and including both will disable the wiki (i.e., blank main page with no error message).
  • Install by adding to config.php
  • Create a forum HomePage, for instance Forum.HomePage with the following content:
    (:pagelist group={$Group} list=normal fmt=forum:)
  • Create a GroupFooter page, for instance Forum.GroupFooter with the following content:
or alternatively use a customised form like on this page: SimpleForumGroupFooter?action=source
(click to see source and copy to the GroupFooter page)
This form is still using commentboxstyled.php, just provides a slightly different layout and different text labels.
  • New You can use any group with the word "Forum" in it as a forum group, for instance Forum, ChessForum, SupportForumForPmwiki. The existence of the word "Forum" makes sure that the right message gets displayed when a new topic gets created.

CommentBoxPlus should be used as an alternative to the commentbox.php recipe script. You may wish to use your own styling of commentbox entries in a pub/css/local.css file. This styling will also apply to the forum Homepage newtopic box and the topic pagelist.

PS: You could create an "upside-down" forum, which puts the commentbox at the top of the page and the posts below in reverse order, displaying the latest post at the top. Instead of using the GroupFooter use the GroupHeader and put there either (:commentbox:) or the alternative form markup as described above (but leave out the word "chrono" in the sample code on SimpleForumGroupFooter.

Design concept

This simple forum combines basically three elements:

  1. for posting messages it uses CommentBoxPlus in its chronological mode using (:commentboxchrono:) in the GroupFooter
  2. for creating new topics it uses a modified version of NewPageBoxPlus with a custom markup (:newforumtopic:) in the forum HomePage. New pages can only be created in the current group, and instead of opening the new page in edit mode it opens the page in browse mode, which displays the commentbox ready to enter content.
  3. for displaying a topic list it uses PageList markup, but to make it more pretty the script defines a new fmt=forum for it, which displays a styled table of page(topic) titles, last modified dates and authors.

Both commentboxplus and newpageboxplus allow for styling of the form, and this styling is also applied to the pagelist topic table, so an integrated styled look can be achieved.

New posts added to a topic page are automatically listed in RecentChanges, and the topic page appears at the top of the list on the forum homepage.

Comments see SimpleForum-Talk

Update History

  • 2019-06-02: Compatible with PHP7+
  • 2007-11-09: Fixed broken CreateNewTopic box.
  • 2006-10-28: Added $RecipeInfo
  • 2006-03-31: Changed method to determine if group is a Forum group once again, as it interfered with blogsimple, for displaying the text message when new topic gets created.
  • 2006-03-24: Updated "Create New Topic" box in line with recent update to newpageboxplus. Changed default topiclist format to include post counts and better styling. Added sample pagelist format template. Changed method to determine if group is a Forum group, for displaying the text message when new topic gets created.
  • 2006-03-03 (V0.5): Bugfix: The "Create New Topic" field was not being properly initialized and cleared. JLuk?
  • 2006-01-17: Bugfix: replaced $ScriptUrl with $PageUrl in newtopic form.
  • 2005-12-29: forumstyled.phpΔ updated to work with newest pmwiki 2.1.beta15 release which made big changes to pagelist.

See Also


User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.