Revision history for WikkaForum


Revision [23291]

Last edited on 2016-05-20 07:38:47 by GmBowen [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[DaveFullard | Delete forum posts]]<<::c::
$remove = array('#%', '======', '=====', '====', '===', '==', '[[', | ']]', '||', '#0025#0025', '<<', '>>', '::c::', '""');
Deletions:
~- [[DaveFullard Delete forum posts]]<<::c::
$remove = array('#%', '======', '=====', '====', '===', '==', '[[', ']]', '||', '#0025#0025', '<<', '>>', '::c::', '""');


Revision [19362]

Edited on 2008-01-28 00:15:26 by GmBowen [Modified links pointing to docs server]

No Differences

Revision [17573]

Edited on 2007-10-01 16:50:18 by GmBowen [Modified links pointing to docs server]
Additions:
With functionality similar to "regular" bulletin boards (such as ""PunBB""), this forum tool can use simple wiki mark-up is **considerably** faster and easier to set up....and "empowers" regular wiki users to set up structured discussions in a manner not normally possible (unless you have access to a server, etc). Additionally, you can add comments and links FAR more easily on the main and on individual forum pages in the clone than one can in the real forum software (because you can use wiki markup). Combined with the wiki mail tool I wrote (WikkaMail) I use this forum approach for my courses instead of real bulletin board software since I have all the needed functionality and more in one spot. [Currently this forum tool uses wiki markup for the "front end" of the bulletin board. In current development is an action (wikkabb.php) which will allow bulletin board management & a look quite similar to traditional bulletin boards but through the wiki (and this wikkaforum tool). There are two advantages this will offer over traditional bb's (from a "community" perspective AND from a teaching/learning perspective in classroom use). Firstly, individual forums discussions can be shared across communities and forums. This is a considerable departure from regular BB's where one is either entirely in one community or not....whereas this tool will permit crossing-over between different communities/classes. Secondly (and consistent with what was written earlier), it allows these inter-linked bulletin boards to be generated by users for their own (community) purposes....not something usually possible with bulletin boards. Development on this tool should conclude in the next few weeks, it will be field tested, and then it will be released here.]
Deletions:
As an example, see my [[http://131.202.10.204/3511forum/ original forum]] for one of my courses and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tools. Almost identical functionality, and the wiki one was **considerably** faster and easier to set up. Additionally, I can add comments and links FAR more easily on individual forum pages in the clone than I ever could in the real forum software. Once I can get a private message system completed (see [[http://gmbowen.educ.unb.ca/wiki/wakka.php?wakka=Mailbox here]]) then I'll use this forum approach for courses instead of an actual forum since I'll have all the needed functionality and more in one spot...and that's even more true when we get simple table formatting (hint hint), etc. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")


Revision [17343]

Edited on 2007-08-06 10:40:07 by BrianKoontz [Removed dead link; added new link]
Additions:
<<**Mods:**
~- [[DaveFullard Delete forum posts]]<<::c::
Deletions:
The "main page" of wikkaforum looks like this.....
http://gmbowen.educ.unb.ca/wikitest/discussionforum.jpg
and the threads look like this....
http://gmbowen.educ.unb.ca/wikitest/discussionforum2.jpg
if you have a collection of forum pages you can use wiki formatting to emulate the front end of "real" forum software (demonstrated with the ##forumcounter.php## code being used)
http://gmbowen.educ.unb.ca/wikitest/forumcounter.jpg


Revision [11677]

Edited on 2005-11-06 16:08:46 by GmBowen [Removed dead link; added new link]
Additions:
As an example, see my [[http://131.202.10.204/3511forum/ original forum]] for one of my courses and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tools. Almost identical functionality, and the wiki one was **considerably** faster and easier to set up. Additionally, I can add comments and links FAR more easily on individual forum pages in the clone than I ever could in the real forum software. Once I can get a private message system completed (see [[http://gmbowen.educ.unb.ca/wiki/wakka.php?wakka=Mailbox here]]) then I'll use this forum approach for courses instead of an actual forum since I'll have all the needed functionality and more in one spot...and that's even more true when we get simple table formatting (hint hint), etc. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")
$this->ptitle = NULL;
$this->pansw = 0;
$this->title = "<TITLE>$this->SFname</TITLE>";
print($this->title);
if(!empty($ptitle)) {
$this->ptitle = "Re: ".$ptitle;
$zawartosc = "\n\n<FORM ACTION=\"".$link."\" METHOD=\"post\" NAME=\"frm\">\n"
. "<TABLE><TR>\n"
. "<TD>Title:</TD><TD><INPUT TYPE=\"text\" NAME=\"frm_ptitle\" VALUE=\"$this->ptitle\" SIZE=\"65\"></TD>\n"
. "</TR><TR>\n"
. "<TD VALIGN=top>Text:</TD><TD><TEXTAREA NAME=\"frm_text\" cols=\"65\" rows=\"10\"></TEXTAREA></TD>\n"
. "</TR><TR>\n"
. "<TD></TD><TD COLLSPAN=\"2\"><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Submit Comment\"></TD>\n"
. "</tr><tr><td></td><td>".$showrules."</td></tr></TABLE>\n"
. "<INPUT TYPE=\"hidden\" NAME=\"frm_ip\" VALUE=\"".$_SERVER['REMOTE_ADDR']."\">\n"
. "<INPUT TYPE=\"hidden\" NAME=\"frm_wid\" VALUE=\"".$this->pansw."\">\n"
. "</FORM>\n\n";
print($zawartosc);
print("<H2>$topic</H2>\n");
if($ptitle=="" or $text==""){
return;
$this->ptitle = addslashes(htmlspecialchars(trim($ptitle)));
$this->text = addslashes(htmlspecialchars(trim($text)));
if ($frm_wid == 0) {
$zapytanie = "INSERT INTO ".$prefix."wikkaforum (wid,for_ptitle,for_text,tag,for_data,for_dataw,for_ip,for_name) VALUES('$frm_wid', '$this->ptitle', '$this->text', '$tag', now(), now(), '$ip', '$name')";
$sql = mysql_query($zapytanie) or die (mysql_error());
} else {
$zapytanie = "INSERT INTO ".$prefix."wikkaforum (wid,for_ptitle,for_text,tag,for_data,for_ip,for_name) VALUES('$frm_wid', '$this->ptitle', '$this->text', '$tag', now(), '$ip', '$name')";
$sql = mysql_query($zapytanie) or die (mysql_error());
$id = mysql_insert_id();
if ($frm_wid == 0) {
$zapytanie = "UPDATE ".$prefix."wikkaforum SET wid='$id' WHERE id='$id'";
#print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
} else {
$zapytanie = "UPDATE ".$prefix."wikkaforum SET for_dataw=now() WHERE id='$frm_wid'";
#print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
$sql = "SELECT * FROM ".$prefix."wikkaforum WHERE id=wid AND tag='$tag' ORDER BY for_dataw DESC";
#print $sql."<br>\n";
$sql = mysql_query($sql) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
print("<TABLE BORDER=\"1\" WIDTH=\"100%\">\n");
while ($row = mysql_fetch_array($sql)) {
$sql1 = "SELECT COUNT(wid)-1 AS num FROM ".$prefix."wikkaforum WHERE wid=".$row['id']." AND tag='$tag' GROUP BY wid";
#print $sql1."<br>\n";
$sql1 = mysql_query($sql1) or die (mysql_error());
$row1 = mysql_fetch_array($sql1);
//number of reactions
$this->react=$row1['num'];
if ($row['for_name'] == "") {
$row['for_name'] = "Guest";
$this->ptitle = stripslashes($row['for_ptitle']);
print("<tr ALIGN='left'><TD>$link2<A HREF=\"".$link."&wid=".$row['id']."\">".$this->ptitle."</A></TD><TD ALIGN=\"center\">Replies: ".$this->react."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_name']."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_dataw']."</TD></tr>\n\n");
unset($this->react);
print("</TABLE>\n");
} else {
print("<br> There are no threaded topics yet. Why don't you start one?<br>\n");
$this->ptitle = ""; //the new thread's title is empty
$sql = "SELECT * FROM ".$prefix."wikkaforum WHERE id=wid AND tag='$tag' ORDER BY for_dataw DESC";
$sql = mysql_query($sql) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
while ($row = mysql_fetch_array($sql)) {
$sql1 = "SELECT COUNT(wid)-1 AS num FROM ".$prefix."wikkaforum WHERE wid=".$row['id']." AND tag='$tag' GROUP BY wid";
#print $sql1."<br>\n";
$sql1 = mysql_query($sql1) or die (mysql_error());
$row1 = mysql_fetch_array($sql1);
//number of reactions
$this->react=$row1['num'];
unset($this->react);
//$this->pansw = $wid;
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE wid='$wid' AND tag='$tag' ORDER BY for_data ASC";
//print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
print("<TABLE BORDER=\"1\" WIDTH=\"100%\">\n");
while ($row = mysql_fetch_array($sql)) {
$this->ptitle = stripslashes($row['for_ptitle']);
$printtext = (stripslashes($row['for_text']));
if ($row['for_name'] == "") {
$row['for_name'] = "Guest";
$pmail = NULL;
$kmail = NULL;
print("<tr ALIGN='left'><TD><b>".$this->ptitle."</b><div ALIGN=\"right\"><i>$pmail".$row['for_name']."$kmail  <FONT SIZE=\"1\">".$row['for_data']."</FONT></i></div>\n\n");
print("<hr>".$printtext."<br><br></TD></tr>\n\n");
print("</TABLE>\n");
} else {
print("   No threads(s) exist for this topic.<br>\n");
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
$sql = mysql_query($zapytanie) or die (mysql_error());
$row = mysql_fetch_array($sql);
$this->ptitle = stripslashes($row['for_ptitle']); //Re title for form
$zapytanie = "SELECT for_ptitle FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
$sql = mysql_query($zapytanie) or die (mysql_error());
$row = mysql_fetch_array($sql);
$this->ptitle = stripslashes($row['for_ptitle']); //Re title for form
print($this->ptitle);
Deletions:
As an example, see my [[http://131.202.167.33/3511forum/ original forum]] for one of my courses and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tools. Almost identical functionality, and the wiki one was **considerably** faster and easier to set up. Additionally, I can add comments and links FAR more easily on individual forum pages in the clone than I ever could in the real forum software. Once I can get a private message system completed (see [[http://gmbowen.educ.unb.ca/wiki/wakka.php?wakka=Mailbox here]]) then I'll use this forum approach for courses instead of an actual forum since I'll have all the needed functionality and more in one spot...and that's even more true when we get simple table formatting (hint hint), etc. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")
$this->ptitle = NULL;
$this->pansw = 0;
$this->title = "<TITLE>$this->SFname</TITLE>";
print($this->title);
if(!empty($ptitle)) {
$this->ptitle = "Re: ".$ptitle;
}
$zawartosc = "\n\n<FORM ACTION=\"".$link."\" METHOD=\"post\" NAME=\"frm\">\n"
. "<TABLE><TR>\n"
. "<TD>Title:</TD><TD><INPUT TYPE=\"text\" NAME=\"frm_ptitle\" VALUE=\"$this->ptitle\" SIZE=\"65\"></TD>\n"
. "</TR><TR>\n"
. "<TD VALIGN=top>Text:</TD><TD><TEXTAREA NAME=\"frm_text\" cols=\"65\" rows=\"10\"></TEXTAREA></TD>\n"
. "</TR><TR>\n"
. "<TD></TD><TD COLLSPAN=\"2\"><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Submit Comment\"></TD>\n"
. "</tr><tr><td></td><td>".$showrules."</td></tr></TABLE>\n"
. "<INPUT TYPE=\"hidden\" NAME=\"frm_ip\" VALUE=\"".$_SERVER['REMOTE_ADDR']."\">\n"
. "<INPUT TYPE=\"hidden\" NAME=\"frm_wid\" VALUE=\"".$this->pansw."\">\n"
. "</FORM>\n\n";
print($zawartosc);
print("<H2>$topic</H2>\n");
if($ptitle=="" or $text==""){
return;
}
$this->ptitle = addslashes(htmlspecialchars(trim($ptitle)));
$this->text = addslashes(htmlspecialchars(trim($text)));
if ($frm_wid == 0) {
$zapytanie = "INSERT INTO ".$prefix."wikkaforum (wid,for_ptitle,for_text,tag,for_data,for_dataw,for_ip,for_name) VALUES('$frm_wid', '$this->ptitle', '$this->text', '$tag', now(), now(), '$ip', '$name')";
$sql = mysql_query($zapytanie) or die (mysql_error());
} else {
$zapytanie = "INSERT INTO ".$prefix."wikkaforum (wid,for_ptitle,for_text,tag,for_data,for_ip,for_name) VALUES('$frm_wid', '$this->ptitle', '$this->text', '$tag', now(), '$ip', '$name')";
$sql = mysql_query($zapytanie) or die (mysql_error());
}
$id = mysql_insert_id();
if ($frm_wid == 0) {
$zapytanie = "UPDATE ".$prefix."wikkaforum SET wid='$id' WHERE id='$id'";
#print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
} else {
$zapytanie = "UPDATE ".$prefix."wikkaforum SET for_dataw=now() WHERE id='$frm_wid'";
#print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
}
$sql = "SELECT * FROM ".$prefix."wikkaforum WHERE id=wid AND tag='$tag' ORDER BY for_dataw DESC";
#print $sql."<br>\n";
$sql = mysql_query($sql) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
print("<TABLE BORDER=\"1\" WIDTH=\"100%\">\n");
while ($row = mysql_fetch_array($sql)) {
$sql1 = "SELECT COUNT(wid)-1 AS num FROM ".$prefix."wikkaforum WHERE wid=".$row['id']." AND tag='$tag' GROUP BY wid";
#print $sql1."<br>\n";
$sql1 = mysql_query($sql1) or die (mysql_error());
$row1 = mysql_fetch_array($sql1);
//number of reactions
$this->react=$row1['num'];
if ($row['for_name'] == "") {
$row['for_name'] = "Guest";
}
$this->ptitle = stripslashes($row['for_ptitle']);
print("<tr ALIGN='left'><TD>$link2<A HREF=\"".$link."&wid=".$row['id']."\">".$this->ptitle."</A></TD><TD ALIGN=\"center\">Replies: ".$this->react."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_name']."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_dataw']."</TD></tr>\n\n");
}
unset($this->react);
print("</TABLE>\n");
} else {
print("<br> There are no threaded topics yet. Why don't you start one?<br>\n");
}
$this->ptitle = ""; //the new thread's title is empty
$sql = "SELECT * FROM ".$prefix."wikkaforum WHERE id=wid AND tag='$tag' ORDER BY for_dataw DESC";
$sql = mysql_query($sql) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
while ($row = mysql_fetch_array($sql)) {
$sql1 = "SELECT COUNT(wid)-1 AS num FROM ".$prefix."wikkaforum WHERE wid=".$row['id']." AND tag='$tag' GROUP BY wid";
#print $sql1."<br>\n";
$sql1 = mysql_query($sql1) or die (mysql_error());
$row1 = mysql_fetch_array($sql1);
//number of reactions
$this->react=$row1['num'];
unset($this->react);
//$this->pansw = $wid;
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE wid='$wid' AND tag='$tag' ORDER BY for_data ASC";
//print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
print("<TABLE BORDER=\"1\" WIDTH=\"100%\">\n");
while ($row = mysql_fetch_array($sql)) {
$this->ptitle = stripslashes($row['for_ptitle']);
$printtext = (stripslashes($row['for_text']));
if ($row['for_name'] == "") {
$row['for_name'] = "Guest";
}
$pmail = NULL;
$kmail = NULL;
print("<tr ALIGN='left'><TD><b>".$this->ptitle."</b><div ALIGN=\"right\"><i>$pmail".$row['for_name']."$kmail  <FONT SIZE=\"1\">".$row['for_data']."</FONT></i></div>\n\n");
print("<hr>".$printtext."<br><br></TD></tr>\n\n");
}
print("</TABLE>\n");
} else {
print("   No threads(s) exist for this topic.<br>\n");
}
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
$sql = mysql_query($zapytanie) or die (mysql_error());
$row = mysql_fetch_array($sql);
$this->ptitle = stripslashes($row['for_ptitle']); //Re title for form
$zapytanie = "SELECT for_ptitle FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
$sql = mysql_query($zapytanie) or die (mysql_error());
$row = mysql_fetch_array($sql);
$this->ptitle = stripslashes($row['for_ptitle']); //Re title for form
print($this->ptitle);


Revision [5752]

Edited on 2005-02-07 16:34:05 by GmBowen [corrected bracket placement in forumcounter.php]
Additions:
====Wikka Forum====
{{lastedit}}

Often one finds wiki's used as adjuncts to other tools....discussion forums for instance. In those forums the main topic threads are determined by the administrator(s) and out of the hands of most of the users. Wiki's, such as Wikka, are meant to provide considerable flexibility for the users and place the control in their hands. At the same time, this freedom can lead to very unstructured and difficult to follow discussions. Below is code for a forum tool that allows an individual user to set up a structured forum thread on **any** page. The page owner can control the contributers to the forum discussions, or leave it open for all to participate. Apart from this, it's easier to set up the wiki & registration into it with a forum tool that can be used in the wiki than it is to set up both a wiki & a forum (plus, there's consistency in registration names). Forums created on one page can be viewed on another (but not edited). A forumcounter action allows seeing the contributions to any particular forum.

As an example, see my [[http://131.202.167.33/3511forum/ original forum]] for one of my courses and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tools. Almost identical functionality, and the wiki one was **considerably** faster and easier to set up. Additionally, I can add comments and links FAR more easily on individual forum pages in the clone than I ever could in the real forum software. Once I can get a private message system completed (see [[http://gmbowen.educ.unb.ca/wiki/wakka.php?wakka=Mailbox here]]) then I'll use this forum approach for courses instead of an actual forum since I'll have all the needed functionality and more in one spot...and that's even more true when we get simple table formatting (hint hint), etc. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")

The //wikkaforum// action allows you to open the discussion threads on any page using ""{{wikkaforum page="pagename"}}"", although entries cannot be made anywhere but the home page (for security reasons). The page owner can designate a user list and a topic title (example: ""{{wikkaforum share="JavaWoman DarTar GmBowen" topic="Paged Comments"}}"") or leave the discussion threads open to all users. If a "collection" of threads is made (see my course clone example) then a main="collectionpage" designation can be made and that will be added to the navigation system automatically. The //forumcounter// action allows one to designate a particular thread and determine the number of threads and, optionally, time of last contribution.

Create the follow table in your wikka database (note that you might have to change the table prefix to what you use for your wikka)
%%
CREATE TABLE `wakka_wikkaforum` (
`id` int(11) NOT NULL auto_increment,
`wid` int(11) NOT NULL default '0',
`for_ptitle` varchar(255) NOT NULL default '',
`for_text` text NOT NULL,
`tag` varchar(50) NOT NULL default '',
`for_data` datetime NOT NULL default '0000-00-00 00:00:00',
`for_dataw` datetime NOT NULL default '0000-00-00 00:00:00',
`for_ip` varchar(15) NOT NULL default '000.000.000.000',
`for_name` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
%%

Place the following code as ##wikkaforum.php## in the ##actions## directory.
%%(php)
<?php
// wikkaforum.php Version 1.0j - Jan 13, 2005 - placed navigational links above entry box. Added variable to function call.
// Use: {{wikkaforum [topic="topic description"] [main="mainpage"] [page="pagename"] [share="name1 name2 name3 etc"]}}
// "main" is used if there is a collection of threads accessed from one wiki page, "main" allows the user
// to easily return to that page by placing a link on the page automatically
// MODIFIED from SForum class V1.4 for use in wikka wiki by GmBowen for a SSHRC research project.
// Modifications & original code released under GPL
// The file wikkaforumfunctions.php MUST be included in a directory in wikka root called "scripts"
// Original Simple Forum code available from www.phpclasses.org
//{{wikkaforum main="WikkaForum" topic="Bakhtin"}}
/**********************************
* SForum class
* @author: Wojciech Napierala XII.2004
* @help: Ondra Marek ondra.marek@interval.cz
* @
* voytass@op.pl
*
* @license: GNU GPL
**********************************
*/
$link = $this->config["base_url"].$this->MiniHref($method, $tag);
$username=$this->GetUserName();
$prefix=$this->config["table_prefix"];
if (empty($page)) {
$tag=$this->getPageTag();
$pageX=$tag;
}
else
{
$tag=$page;
}

// code to determine who can contribute to the threads
if(empty($share)){$share = 'ALL';}
$tok = strtok($share, " \n\t");
while ($tok) {
if($tok == $this->GetUserName() || $tok == "ALL") { $use = 'true';}
$tok = strtok(" \n\t");
}
if (strtoupper($this->GetUserName())==strtoupper($this->GetPageOwner())){$use = 'true';}

// check so that when there are multiple instances of the action one cannot "add" to the database
// in response to having a thread from another page open (trust me, this code is necessary)
$tablepgname = $this->LoadSingle("SELECT tag FROM ".$this->config['table_prefix']."wikkaforum WHERE wid='".$_GET['wid']."' LIMIT 0,1");
$shouldwrite = $tablepgname[tag];
if (($shouldwrite==$this->getPageTag()) || (empty($shouldwrite))) {$use2 = 'true';}

// CLASS STATEMENT STARTS HERE. Using include_once prevents function conflicts & allows multiple instances on the same page
include_once("./scripts/wikkaforumfunctions.php");
// CLASS STATEMENT ENDS HERE.

if (!isset($forum)) {
$forum = new SForum;
}
?>
<div align="center">
<table WIDTH='90%' border='0'><tr ALIGN='left'><td>
<?php
$forum->Show_SFname($topic);
if ($main==""){
if (!empty($_GET['wid'])) {
echo "  <A HREF=\"".$link."\"><small>Return to Thread List</small></A>\n";
print("<br>\n");
}
else {
echo "<A HREF=\"".$link."\"><small>  </small></A>\n";
print("<br>\n");
}
}
else
{
if ($this->IsWikiName($main)) {$link2 = "<A HREF=\"".$this->config["base_url"].$main."\">".$main."</A>";}
else {
echo $main;
}
if (!empty($_GET['wid'])) {$joiner=">>";}
if (empty($topic) && ($page!=$this->getPageTag())) {$topic=$tag;}
else{
$topic=$this->MiniHref($method, $tag);
}

echo $link2.">><A HREF=\"".$link."\">".$topic."</A>".$joiner;
$forum->Show_SForum_Thread_Name($_GET['wid'], $tag, $prefix);
}
if (isset($_POST['submit'])) {
if (!empty($_POST['frm_ptitle']))
{
if(empty($page))
{
$forum->Add_new_post($_POST['frm_ptitle'],$_POST['frm_text'],$tag,$_POST['frm_ip'],$username,$_POST['frm_wid'],$prefix);
}
}
}
if (isset($_GET['wid'])) {
#phpinfo();
$forum->Show_SForum_Threads($_GET['wid'], $tag, $prefix);
$forum->pansw = $_GET['wid'];
} else {
$forum->Show_SForum($link, $tag, $prefix);
$forum->pansw = 0;
}
print("\n");
if ($main==""){
if (!empty($_GET['wid'])) {
echo "  <A HREF=\"".$link."\"><small>Return to Thread List</small></A>\n";
print("<br>\n");
}
else {
echo "<A HREF=\"".$link."\"><small>  </small></A>\n";
print("<br>\n");
}
}
else
{
if ($this->IsWikiName($main)) {$link2 = "<A HREF=\"".$this->config["base_url"].$main."\">".$main."</A>";}
else {
echo $main;
}
if (!empty($_GET['wid'])) {$joiner=">>";}
if (empty($topic) && ($page!=$this->getPageTag())) {$topic=$tag;}
else{
$topic=$this->MiniHref($method, $tag);
}

echo $link2.">><A HREF=\"".$link."\">".$topic."</A>".$joiner;
$forum->Show_SForum_Thread_Name($_GET['wid'], $tag, $prefix);
}
if ($user = $this->GetUser())
{
if ($pageX==$this->getPageTag())
{
if ($use == 'true')
{
if(empty($page))
{
if ($use2 == 'true')
{
$forum->Show_frm($forum->ptitle, $link, $_GET['wid']);
}
}
}
}
else
{
echo "<small>  This forum originates from ".$page.".</small><br>";
}
}
else
{
print("<small>Sorry, you need to be a registered & logged-in user to contribute to the forums.</small>");
if ($pageX!=$this->getPageTag()){print("<small>  This forum originates from ".$pageX.".</small><br>");}
}
?>
</td></tr></table></div>
%%

The following file contains the functions for ##wikkaforum.php## and must be saved in a file called ##wikkaforumfunctions.php## and stored in a directory called ##scripts## placed in the wikka root. (Thanks to JW to steering me towards this approach!!)
%%(php)
<?php
// wikkaforumfunctions.php Version 1.0i - Jan 13, 2005 - added several wikka formatting features to forum output
// USE: required to be able to use wikkaforum.php & forumcounter.php actions.
// This file **must** be placed in a directory in wikka root called "scripts".
// MODIFIED from SForum class V1.4 for use in wikka wiki by GmBowen for a SSHRC research project.
// Modifications & original code released under GPL
// Original Simple Forum class available from www.phpclasses.org
// **NOTE** for inclusion on a wiki page double percents were replaced by #0025 on line 154, they need
// to be replaced as double percents. It is not advised that you do not replace code formatting marks.
/**********************************
* SForum class
* @author: Wojciech Napierała XII.2004
* @help: Ondra Marek ondra.marek@interval.cz
* @
* voytass@op.pl
*
* @license: GNU GPL
**********************************
*/
class SForum {
var $ptitle;
var $react; // number of answers in a thread
var $pansw;
var $title;

// SForum: constructor
function SForum() {
$this->ptitle = NULL;
$this->pansw = 0;
$this->title = "<TITLE>$this->SFname</TITLE>";
print($this->title);
}

// Show_frm: displays the form
function Show_frm($ptitle=NULL, $link, $wid) {
if(!empty($ptitle)) {
$this->ptitle = "Re: ".$ptitle;
}
$showrules="";
if (!EMPTY($wid)){$showrules="<small>Except in titles, several wiki formatting codes (bold(<bold>**</bold>), italics(<strong>//</strong>), underline(<strong>__</strong>),<br /> strikethrough(<strong>++</strong>), highlight (two single quotes...<strong>''</strong>), centering (<strong>@@</strong>) and bulleted lists(<strong>~-</strong>) <br />(and other lists)) are active. Headings, actions, tables, and external linking are not activated. </small>";}
$zawartosc = "\n\n<FORM ACTION=\"".$link."\" METHOD=\"post\" NAME=\"frm\">\n"
. "<TABLE><TR>\n"
. "<TD>Title:</TD><TD><INPUT TYPE=\"text\" NAME=\"frm_ptitle\" VALUE=\"$this->ptitle\" SIZE=\"65\"></TD>\n"
. "</TR><TR>\n"
. "<TD VALIGN=top>Text:</TD><TD><TEXTAREA NAME=\"frm_text\" cols=\"65\" rows=\"10\"></TEXTAREA></TD>\n"
. "</TR><TR>\n"
. "<TD></TD><TD COLLSPAN=\"2\"><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Submit Comment\"></TD>\n"
. "</tr><tr><td></td><td>".$showrules."</td></tr></TABLE>\n"
. "<INPUT TYPE=\"hidden\" NAME=\"frm_ip\" VALUE=\"".$_SERVER['REMOTE_ADDR']."\">\n"
. "<INPUT TYPE=\"hidden\" NAME=\"frm_wid\" VALUE=\"".$this->pansw."\">\n"
. "</FORM>\n\n";
print($zawartosc);
}

// Show_SFname : Show SForum name as text
function Show_SFname($topic) {
print("<H2>$topic</H2>\n");
}

// Add_new_post: Adds new record to DB (updated 10 Jan 2005)
function Add_new_post($ptitle,$text,$tag,$ip,$name,$frm_wid,$prefix) {
if($ptitle=="" or $text==""){
return;
}
$this->ptitle = addslashes(htmlspecialchars(trim($ptitle)));
$this->text = addslashes(htmlspecialchars(trim($text)));
if ($frm_wid == 0) {
$zapytanie = "INSERT INTO ".$prefix."wikkaforum (wid,for_ptitle,for_text,tag,for_data,for_dataw,for_ip,for_name) VALUES('$frm_wid', '$this->ptitle', '$this->text', '$tag', now(), now(), '$ip', '$name')";
$sql = mysql_query($zapytanie) or die (mysql_error());
} else {
$zapytanie = "INSERT INTO ".$prefix."wikkaforum (wid,for_ptitle,for_text,tag,for_data,for_ip,for_name) VALUES('$frm_wid', '$this->ptitle', '$this->text', '$tag', now(), '$ip', '$name')";
$sql = mysql_query($zapytanie) or die (mysql_error());
}
$id = mysql_insert_id();
if ($frm_wid == 0) {
$zapytanie = "UPDATE ".$prefix."wikkaforum SET wid='$id' WHERE id='$id'";
#print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
} else {
$zapytanie = "UPDATE ".$prefix."wikkaforum SET for_dataw=now() WHERE id='$frm_wid'";
#print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
}

}

// Show_SForum: Displays the main message of threads
function Show_SForum($link, $tag, $prefix) {
$sql = "SELECT * FROM ".$prefix."wikkaforum WHERE id=wid AND tag='$tag' ORDER BY for_dataw DESC";
#print $sql."<br>\n";
$sql = mysql_query($sql) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
print("<TABLE BORDER=\"1\" WIDTH=\"100%\">\n");
while ($row = mysql_fetch_array($sql)) {
$sql1 = "SELECT COUNT(wid)-1 AS num FROM ".$prefix."wikkaforum WHERE wid=".$row['id']." AND tag='$tag' GROUP BY wid";
#print $sql1."<br>\n";
$sql1 = mysql_query($sql1) or die (mysql_error());
$row1 = mysql_fetch_array($sql1);
//number of reactions
$this->react=$row1['num'];
if ($row['for_name'] == "") {
$row['for_name'] = "Guest";
}
$this->ptitle = stripslashes($row['for_ptitle']);
print("<tr ALIGN='left'><TD>$link2<A HREF=\"".$link."&wid=".$row['id']."\">".$this->ptitle."</A></TD><TD ALIGN=\"center\">Replies: ".$this->react."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_name']."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_dataw']."</TD></tr>\n\n");
}

unset($this->react);
print("</TABLE>\n");
} else {
print("<br> There are no threaded topics yet. Why don't you start one?<br>\n");
}
$this->ptitle = ""; //the new thread's title is empty
}
// Show_ForumCount: Displays the count of the number of threads
function Show_SForumCounter($tag, $prefix) {
$sql = "SELECT * FROM ".$prefix."wikkaforum WHERE id=wid AND tag='$tag' ORDER BY for_dataw DESC";
$sql = mysql_query($sql) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
while ($row = mysql_fetch_array($sql)) {
$sql1 = "SELECT COUNT(wid)-1 AS num FROM ".$prefix."wikkaforum WHERE wid=".$row['id']." AND tag='$tag' GROUP BY wid";
#print $sql1."<br>\n";
$sql1 = mysql_query($sql1) or die (mysql_error());
$row1 = mysql_fetch_array($sql1);
//number of reactions
$this->react=$row1['num'];
$count=$count + 1;
}

unset($this->react);
echo "<small>[# of threads:".$count.$row['for_data']."</small>";
}else{
echo "<small>[# of threads: 0</small>";
}
}
// Show_SForum_Threads: Displays all messages of a thread
function Show_SForum_Threads($wid, $tag, $prefix) {
global $wakka;
//$this->pansw = $wid;
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE wid='$wid' AND tag='$tag' ORDER BY for_data ASC";
//print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
print("<TABLE BORDER=\"1\" WIDTH=\"100%\">\n");
while ($row = mysql_fetch_array($sql)) {
$this->ptitle = stripslashes($row['for_ptitle']);
$printtext = (stripslashes($row['for_text']));
$brackets = Array ('/{{/i', '/}}/i');
$changeto = '|.|';
$printtext = preg_replace($brackets, $changeto, $printtext);
$remove = array('#%', '======', '=====', '====', '===', '==', '[[', ']]', '||', '#0025#0025', '<<', '>>', '::c::', '""');
$printtext = str_replace($remove, '', $printtext);
$printtext = $wakka->format($printtext);
if ($row['for_name'] == "") {
$row['for_name'] = "Guest";
}
$pmail = NULL;
$kmail = NULL;
print("<tr ALIGN='left'><TD><b>".$this->ptitle."</b><div ALIGN=\"right\"><i>$pmail".$row['for_name']."$kmail  <FONT SIZE=\"1\">".$row['for_data']."</FONT></i></div>\n\n");
print("<hr>".$printtext."<br><br></TD></tr>\n\n");
}
print("</TABLE>\n");
} else {
print("   No threads(s) exist for this topic.<br>\n");
}
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
$sql = mysql_query($zapytanie) or die (mysql_error());
$row = mysql_fetch_array($sql);
$this->ptitle = stripslashes($row['for_ptitle']); //Re title for form
}
// Show_SForum_Thread_Name: Displays all messages of a thread
function Show_SForum_Thread_Name($wid, $tag, $prefix) {
$zapytanie = "SELECT for_ptitle FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
$sql = mysql_query($zapytanie) or die (mysql_error());
$row = mysql_fetch_array($sql);
$this->ptitle = stripslashes($row['for_ptitle']); //Re title for form
print($this->ptitle);
}
}
?>
%%

This final action should be called ##forumcounter.php## and placed in the actions directory.
%%(php)
<?php
// forumcounter.php Version 1.0c - Feb 7, 2005 - corrected bracket placement
// PURPOSE - Counts number of threads in specific forum (each forum is associated w/ a specific page)
// USE: {{forumcounter [page="forumpage"] [last="yes"]}} provides a count of the number of threads
// in the forum on the designated page (default is current page).
// last="yes" designates that the last time/date a thread was contributed to is desired.
// MODIFIED from SForum class V1.2 for use in wikka wiki by GmBowen for a SSHRC research project.
// Modifications & original code released under GPL
// REQUIRES wikkaforumfunctions.php to be included in a directory in wikka root called "scripts"
// Original Simple Forum code available from www.phpclasses.org
/**********************************
* SForum class
* @author: Wojciech Napierala XII.2004
* @help: Ondra Marek ondra.marek@interval.cz
* @
* voytass@op.pl
*
* @license: GNU GPL
**********************************
*/
$prefix=$this->config["table_prefix"];
if (empty($page)) {$page=$this->getPageTag();}

$tag=$page;

// CLASS STATEMENT STARTS HERE. Using include_once prevents function conflicts
// & allows multiple instances on the same page
include_once("./scripts/wikkaforumfunctions.php");
// CLASS STATEMENT ENDS HERE.
if (!isset($forum)) {
$forum = new SForum;
}
if (!isset($_GET['wid'])) {
$forum->Show_SForumCounter($tag, $prefix);
$last=(strtolower($last));
if ($last=="yes"){
$tablepgname = $this->LoadAll("SELECT * FROM ".$this->config['table_prefix']."wikkaforum WHERE tag='".$tag."' ORDER BY for_data DESC LIMIT 0,1");
foreach($tablepgname as $ltime)
{
echo "<small>  Last edit: ".$ltime["for_data"]."</small>";
}
}
echo "<small>]</small>";
}
?>
%%

The "main page" of wikkaforum looks like this.....
http://gmbowen.educ.unb.ca/wikitest/discussionforum.jpg
and the threads look like this....
http://gmbowen.educ.unb.ca/wikitest/discussionforum2.jpg
if you have a collection of forum pages you can use wiki formatting to emulate the front end of "real" forum software (demonstrated with the ##forumcounter.php## code being used)
http://gmbowen.educ.unb.ca/wikitest/forumcounter.jpg
----
To Do/Further Development list:
- search feature for forum table...for both individual wikkaforum & all wikkaforum's?
- list your contributions (add to code above so can just click on a link & show your comments & replies)...or maybe just put a "star" or something beside the threadnames (on the front page) that you've contributed to?
- an action that could be placed on the forum main page (see my clone example) that could indicate if you'd contributed to that wikkaforum.
- if you enter a thread name/content, then "refresh" the page from the browser navigation bar, then the thread name/content is re-entered. I've played with this tons to no avail. Any suggestions???

----
Deletions:
====Wikka Forum====
{{lastedit}}

Often one finds wiki's used as adjuncts to other tools....discussion forums for instance. In those forums the main topic threads are determined by the administrator(s) and out of the hands of most of the users. Wiki's, such as Wikka, are meant to provide considerable flexibility for the users and place the control in their hands. At the same time, this freedom can lead to very unstructured and difficult to follow discussions. Below is code for a forum tool that allows an individual user to set up a structured forum thread on **any** page. The page owner can control the contributers to the forum discussions, or leave it open for all to participate. Apart from this, it's easier to set up the wiki & registration into it with a forum tool that can be used in the wiki than it is to set up both a wiki & a forum (plus, there's consistency in registration names). Forums created on one page can be viewed on another (but not edited). A forumcounter action allows seeing the contributions to any particular forum.

As an example, see my [[http://131.202.167.33/3511forum/ original forum]] for one of my courses and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tools. Almost identical functionality, and the wiki one was **considerably** faster and easier to set up. Additionally, I can add comments and links FAR more easily on individual forum pages in the clone than I ever could in the real forum software. Once I can get a private message system completed (see [[http://gmbowen.educ.unb.ca/wiki/wakka.php?wakka=Mailbox here]]) then I'll use this forum approach for courses instead of an actual forum since I'll have all the needed functionality and more in one spot...and that's even more true when we get simple table formatting (hint hint), etc. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")

The //wikkaforum// action allows you to open the discussion threads on any page using ""{{wikkaforum page="pagename"}}"", although entries cannot be made anywhere but the home page (for security reasons). The page owner can designate a user list and a topic title (example: ""{{wikkaforum share="JavaWoman DarTar GmBowen" topic="Paged Comments"}}"") or leave the discussion threads open to all users. If a "collection" of threads is made (see my course clone example) then a main="collectionpage" designation can be made and that will be added to the navigation system automatically. The //forumcounter// action allows one to designate a particular thread and determine the number of threads and, optionally, time of last contribution.

Create the follow table in your wikka database (note that you might have to change the table prefix to what you use for your wikka)
%%
CREATE TABLE `wakka_wikkaforum` (
`id` int(11) NOT NULL auto_increment,
`wid` int(11) NOT NULL default '0',
`for_ptitle` varchar(255) NOT NULL default '',
`for_text` text NOT NULL,
`tag` varchar(50) NOT NULL default '',
`for_data` datetime NOT NULL default '0000-00-00 00:00:00',
`for_dataw` datetime NOT NULL default '0000-00-00 00:00:00',
`for_ip` varchar(15) NOT NULL default '000.000.000.000',
`for_name` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
%%

Place the following code as ##wikkaforum.php## in the ##actions## directory.
%%(php)
<?php
// wikkaforum.php Version 1.0j - Jan 13, 2005 - placed navigational links above entry box. Added variable to function call.
// Use: {{wikkaforum [topic="topic description"] [main="mainpage"] [page="pagename"] [share="name1 name2 name3 etc"]}}
// "main" is used if there is a collection of threads accessed from one wiki page, "main" allows the user
// to easily return to that page by placing a link on the page automatically
// MODIFIED from SForum class V1.4 for use in wikka wiki by GmBowen for a SSHRC research project.
// Modifications & original code released under GPL
// The file wikkaforumfunctions.php MUST be included in a directory in wikka root called "scripts"
// Original Simple Forum code available from www.phpclasses.org
//{{wikkaforum main="WikkaForum" topic="Bakhtin"}}
/**********************************
* SForum class
* @author: Wojciech Napierala XII.2004
* @help: Ondra Marek ondra.marek@interval.cz
* @
* voytass@op.pl
*
* @license: GNU GPL
**********************************
*/
$link = $this->config["base_url"].$this->MiniHref($method, $tag);
$username=$this->GetUserName();
$prefix=$this->config["table_prefix"];
if (empty($page)) {
$tag=$this->getPageTag();
$pageX=$tag;
}
else
{
$tag=$page;
}

// code to determine who can contribute to the threads
if(empty($share)){$share = 'ALL';}
$tok = strtok($share, " \n\t");
while ($tok) {
if($tok == $this->GetUserName() || $tok == "ALL") { $use = 'true';}
$tok = strtok(" \n\t");
}
if (strtoupper($this->GetUserName())==strtoupper($this->GetPageOwner())){$use = 'true';}

// check so that when there are multiple instances of the action one cannot "add" to the database
// in response to having a thread from another page open (trust me, this code is necessary)
$tablepgname = $this->LoadSingle("SELECT tag FROM ".$this->config['table_prefix']."wikkaforum WHERE wid='".$_GET['wid']."' LIMIT 0,1");
$shouldwrite = $tablepgname[tag];
if (($shouldwrite==$this->getPageTag()) || (empty($shouldwrite))) {$use2 = 'true';}

// CLASS STATEMENT STARTS HERE. Using include_once prevents function conflicts & allows multiple instances on the same page
include_once("./scripts/wikkaforumfunctions.php");
// CLASS STATEMENT ENDS HERE.

if (!isset($forum)) {
$forum = new SForum;
}
?>
<div align="center">
<table WIDTH='90%' border='0'><tr ALIGN='left'><td>
<?php
$forum->Show_SFname($topic);
if ($main==""){
if (!empty($_GET['wid'])) {
echo "  <A HREF=\"".$link."\"><small>Return to Thread List</small></A>\n";
print("<br>\n");
}
else {
echo "<A HREF=\"".$link."\"><small>  </small></A>\n";
print("<br>\n");
}
}
else
{
if ($this->IsWikiName($main)) {$link2 = "<A HREF=\"".$this->config["base_url"].$main."\">".$main."</A>";}
else {
echo $main;
}
if (!empty($_GET['wid'])) {$joiner=">>";}
if (empty($topic) && ($page!=$this->getPageTag())) {$topic=$tag;}
else{
$topic=$this->MiniHref($method, $tag);
}

echo $link2.">><A HREF=\"".$link."\">".$topic."</A>".$joiner;
$forum->Show_SForum_Thread_Name($_GET['wid'], $tag, $prefix);
}
if (isset($_POST['submit'])) {
if (!empty($_POST['frm_ptitle']))
{
if(empty($page))
{
$forum->Add_new_post($_POST['frm_ptitle'],$_POST['frm_text'],$tag,$_POST['frm_ip'],$username,$_POST['frm_wid'],$prefix);
}
}
}
if (isset($_GET['wid'])) {
#phpinfo();
$forum->Show_SForum_Threads($_GET['wid'], $tag, $prefix);
$forum->pansw = $_GET['wid'];
} else {
$forum->Show_SForum($link, $tag, $prefix);
$forum->pansw = 0;
}
print("\n");
if ($main==""){
if (!empty($_GET['wid'])) {
echo "  <A HREF=\"".$link."\"><small>Return to Thread List</small></A>\n";
print("<br>\n");
}
else {
echo "<A HREF=\"".$link."\"><small>  </small></A>\n";
print("<br>\n");
}
}
else
{
if ($this->IsWikiName($main)) {$link2 = "<A HREF=\"".$this->config["base_url"].$main."\">".$main."</A>";}
else {
echo $main;
}
if (!empty($_GET['wid'])) {$joiner=">>";}
if (empty($topic) && ($page!=$this->getPageTag())) {$topic=$tag;}
else{
$topic=$this->MiniHref($method, $tag);
}

echo $link2.">><A HREF=\"".$link."\">".$topic."</A>".$joiner;
$forum->Show_SForum_Thread_Name($_GET['wid'], $tag, $prefix);
}
if ($user = $this->GetUser())
{
if ($pageX==$this->getPageTag())
{
if ($use == 'true')
{
if(empty($page))
{
if ($use2 == 'true')
{
$forum->Show_frm($forum->ptitle, $link, $_GET['wid']);
}
}
}
}
else
{
echo "<small>  This forum originates from ".$page.".</small><br>";
}
}
else
{
print("<small>Sorry, you need to be a registered & logged-in user to contribute to the forums.</small>");
if ($pageX!=$this->getPageTag()){print("<small>  This forum originates from ".$pageX.".</small><br>");}
}
?>
</td></tr></table></div>
%%

The following file contains the functions for ##wikkaforum.php## and must be saved in a file called ##wikkaforumfunctions.php## and stored in a directory called ##scripts## placed in the wikka root. (Thanks to JW to steering me towards this approach!!)
%%(php)
<?php
// wikkaforumfunctions.php Version 1.0i - Jan 13, 2005 - added several wikka formatting features to forum output
// USE: required to be able to use wikkaforum.php & forumcounter.php actions.
// This file **must** be placed in a directory in wikka root called "scripts".
// MODIFIED from SForum class V1.4 for use in wikka wiki by GmBowen for a SSHRC research project.
// Modifications & original code released under GPL
// Original Simple Forum class available from www.phpclasses.org
// **NOTE** for inclusion on a wiki page double percents were replaced by #0025 on line 154, they need
// to be replaced as double percents. It is not advised that you do not replace code formatting marks.
/**********************************
* SForum class
* @author: Wojciech Napierała XII.2004
* @help: Ondra Marek ondra.marek@interval.cz
* @
* voytass@op.pl
*
* @license: GNU GPL
**********************************
*/
class SForum {
var $ptitle;
var $react; // number of answers in a thread
var $pansw;
var $title;

// SForum: constructor
function SForum() {
$this->ptitle = NULL;
$this->pansw = 0;
$this->title = "<TITLE>$this->SFname</TITLE>";
print($this->title);
}

// Show_frm: displays the form
function Show_frm($ptitle=NULL, $link, $wid) {
if(!empty($ptitle)) {
$this->ptitle = "Re: ".$ptitle;
}
$showrules="";
if (!EMPTY($wid)){$showrules="<small>Except in titles, several wiki formatting codes (bold(<bold>**</bold>), italics(<strong>//</strong>), underline(<strong>__</strong>),<br /> strikethrough(<strong>++</strong>), highlight (two single quotes...<strong>''</strong>), centering (<strong>@@</strong>) and bulleted lists(<strong>~-</strong>) <br />(and other lists)) are active. Headings, actions, tables, and external linking are not activated. </small>";}
$zawartosc = "\n\n<FORM ACTION=\"".$link."\" METHOD=\"post\" NAME=\"frm\">\n"
. "<TABLE><TR>\n"
. "<TD>Title:</TD><TD><INPUT TYPE=\"text\" NAME=\"frm_ptitle\" VALUE=\"$this->ptitle\" SIZE=\"65\"></TD>\n"
. "</TR><TR>\n"
. "<TD VALIGN=top>Text:</TD><TD><TEXTAREA NAME=\"frm_text\" cols=\"65\" rows=\"10\"></TEXTAREA></TD>\n"
. "</TR><TR>\n"
. "<TD></TD><TD COLLSPAN=\"2\"><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Submit Comment\"></TD>\n"
. "</tr><tr><td></td><td>".$showrules."</td></tr></TABLE>\n"
. "<INPUT TYPE=\"hidden\" NAME=\"frm_ip\" VALUE=\"".$_SERVER['REMOTE_ADDR']."\">\n"
. "<INPUT TYPE=\"hidden\" NAME=\"frm_wid\" VALUE=\"".$this->pansw."\">\n"
. "</FORM>\n\n";
print($zawartosc);
}

// Show_SFname : Show SForum name as text
function Show_SFname($topic) {
print("<H2>$topic</H2>\n");
}

// Add_new_post: Adds new record to DB (updated 10 Jan 2005)
function Add_new_post($ptitle,$text,$tag,$ip,$name,$frm_wid,$prefix) {
if($ptitle=="" or $text==""){
return;
}
$this->ptitle = addslashes(htmlspecialchars(trim($ptitle)));
$this->text = addslashes(htmlspecialchars(trim($text)));
if ($frm_wid == 0) {
$zapytanie = "INSERT INTO ".$prefix."wikkaforum (wid,for_ptitle,for_text,tag,for_data,for_dataw,for_ip,for_name) VALUES('$frm_wid', '$this->ptitle', '$this->text', '$tag', now(), now(), '$ip', '$name')";
$sql = mysql_query($zapytanie) or die (mysql_error());
} else {
$zapytanie = "INSERT INTO ".$prefix."wikkaforum (wid,for_ptitle,for_text,tag,for_data,for_ip,for_name) VALUES('$frm_wid', '$this->ptitle', '$this->text', '$tag', now(), '$ip', '$name')";
$sql = mysql_query($zapytanie) or die (mysql_error());
}
$id = mysql_insert_id();
if ($frm_wid == 0) {
$zapytanie = "UPDATE ".$prefix."wikkaforum SET wid='$id' WHERE id='$id'";
#print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
} else {
$zapytanie = "UPDATE ".$prefix."wikkaforum SET for_dataw=now() WHERE id='$frm_wid'";
#print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
}

}

// Show_SForum: Displays the main message of threads
function Show_SForum($link, $tag, $prefix) {
$sql = "SELECT * FROM ".$prefix."wikkaforum WHERE id=wid AND tag='$tag' ORDER BY for_dataw DESC";
#print $sql."<br>\n";
$sql = mysql_query($sql) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
print("<TABLE BORDER=\"1\" WIDTH=\"100%\">\n");
while ($row = mysql_fetch_array($sql)) {
$sql1 = "SELECT COUNT(wid)-1 AS num FROM ".$prefix."wikkaforum WHERE wid=".$row['id']." AND tag='$tag' GROUP BY wid";
#print $sql1."<br>\n";
$sql1 = mysql_query($sql1) or die (mysql_error());
$row1 = mysql_fetch_array($sql1);
//number of reactions
$this->react=$row1['num'];
if ($row['for_name'] == "") {
$row['for_name'] = "Guest";
}
$this->ptitle = stripslashes($row['for_ptitle']);
print("<tr ALIGN='left'><TD>$link2<A HREF=\"".$link."&wid=".$row['id']."\">".$this->ptitle."</A></TD><TD ALIGN=\"center\">Replies: ".$this->react."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_name']."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_dataw']."</TD></tr>\n\n");
}

unset($this->react);
print("</TABLE>\n");
} else {
print("<br> There are no threaded topics yet. Why don't you start one?<br>\n");
}
$this->ptitle = ""; //the new thread's title is empty
}
// Show_ForumCount: Displays the count of the number of threads
function Show_SForumCounter($tag, $prefix) {
$sql = "SELECT * FROM ".$prefix."wikkaforum WHERE id=wid AND tag='$tag' ORDER BY for_dataw DESC";
$sql = mysql_query($sql) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
while ($row = mysql_fetch_array($sql)) {
$sql1 = "SELECT COUNT(wid)-1 AS num FROM ".$prefix."wikkaforum WHERE wid=".$row['id']." AND tag='$tag' GROUP BY wid";
#print $sql1."<br>\n";
$sql1 = mysql_query($sql1) or die (mysql_error());
$row1 = mysql_fetch_array($sql1);
//number of reactions
$this->react=$row1['num'];
$count=$count + 1;
}

unset($this->react);
echo "<small>[# of threads:".$count.$row['for_data']."</small>";
}else{
echo "<small>[# of threads: 0</small>";
}
}
// Show_SForum_Threads: Displays all messages of a thread
function Show_SForum_Threads($wid, $tag, $prefix) {
global $wakka;
//$this->pansw = $wid;
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE wid='$wid' AND tag='$tag' ORDER BY for_data ASC";
//print $zapytanie;
$sql = mysql_query($zapytanie) or die (mysql_error());
$iledokumentow = mysql_affected_rows();
if ($iledokumentow > 0) {
print("<TABLE BORDER=\"1\" WIDTH=\"100%\">\n");
while ($row = mysql_fetch_array($sql)) {
$this->ptitle = stripslashes($row['for_ptitle']);
$printtext = (stripslashes($row['for_text']));
$brackets = Array ('/{{/i', '/}}/i');
$changeto = '|.|';
$printtext = preg_replace($brackets, $changeto, $printtext);
$remove = array('#%', '======', '=====', '====', '===', '==', '[[', ']]', '||', '#0025#0025', '<<', '>>', '::c::', '""');
$printtext = str_replace($remove, '', $printtext);
$printtext = $wakka->format($printtext);
if ($row['for_name'] == "") {
$row['for_name'] = "Guest";
}
$pmail = NULL;
$kmail = NULL;
print("<tr ALIGN='left'><TD><b>".$this->ptitle."</b><div ALIGN=\"right\"><i>$pmail".$row['for_name']."$kmail  <FONT SIZE=\"1\">".$row['for_data']."</FONT></i></div>\n\n");
print("<hr>".$printtext."<br><br></TD></tr>\n\n");
}
print("</TABLE>\n");
} else {
print("   No threads(s) exist for this topic.<br>\n");
}
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
$sql = mysql_query($zapytanie) or die (mysql_error());
$row = mysql_fetch_array($sql);
$this->ptitle = stripslashes($row['for_ptitle']); //Re title for form
}
// Show_SForum_Thread_Name: Displays all messages of a thread
function Show_SForum_Thread_Name($wid, $tag, $prefix) {
$zapytanie = "SELECT for_ptitle FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
$sql = mysql_query($zapytanie) or die (mysql_error());
$row = mysql_fetch_array($sql);
$this->ptitle = stripslashes($row['for_ptitle']); //Re title for form
print($this->ptitle);
}
}
?>
%%

This final action should be called ##forumcounter.php## and placed in the actions directory.
%%(php)
<?php
// forumcounter.php Version 1.0b - Jan 10, 2005 - corrected time sort order
// PURPOSE - Counts number of threads in specific forum (each forum is associated w/ a specific page)
// USE: {{forumcounter [page="forumpage"] [last="yes"]}} provides a count of the number of threads
// in the forum on the designated page (default is current page).
// last="yes" designates that the last time/date a thread was contributed to is desired.
// MODIFIED from SForum class V1.2 for use in wikka wiki by GmBowen for a SSHRC research project.
// Modifications & original code released under GPL
// REQUIRES wikkaforumfunctions.php to be included in a directory in wikka root called "scripts"
// Original Simple Forum code available from www.phpclasses.org
/**********************************
* SForum class
* @author: Wojciech Napierala XII.2004
* @help: Ondra Marek ondra.marek@interval.cz
* @
* voytass@op.pl
*
* @license: GNU GPL
**********************************
*/
$prefix=$this->config["table_prefix"];
if (empty($page)) {$page=$this->getPageTag();}

$tag=$page;

// CLASS STATEMENT STARTS HERE. Using include_once prevents function conflicts
// & allows multiple instances on the same page
include_once("./scripts/wikkaforumfunctions.php");
// CLASS STATEMENT ENDS HERE.
if (!isset($forum)) {
$forum = new SForum;
}
if (!isset($_GET['wid'])) {
$forum->Show_SForumCounter($tag, $prefix);
$last=(strtolower($last));
if ($last=="yes"){
$tablepgname = $this->LoadAll("SELECT * FROM ".$this->config['table_prefix']."wikkaforum WHERE tag='".$tag."' ORDER BY for_data DESC LIMIT 0,1");
foreach($tablepgname as $ltime)
{
echo "<small>  Last edit: ".$ltime["for_data"]."]</small>";
}
}else{
echo "<small>]</small>";
}
}
?>
%%

The "main page" of wikkaforum looks like this.....
http://gmbowen.educ.unb.ca/wikitest/discussionforum.jpg
and the threads look like this....
http://gmbowen.educ.unb.ca/wikitest/discussionforum2.jpg
if you have a collection of forum pages you can use wiki formatting to emulate the front end of "real" forum software (demonstrated with the ##forumcounter.php## code being used)
http://gmbowen.educ.unb.ca/wikitest/forumcounter.jpg
----
To Do/Further Development list:
- search feature for forum table...for both individual wikkaforum & all wikkaforum's?
- list your contributions (add to code above so can just click on a link & show your comments & replies)...or maybe just put a "star" or something beside the threadnames (on the front page) that you've contributed to?
- an action that could be placed on the forum main page (see my clone example) that could indicate if you'd contributed to that wikkaforum.
- if you enter a thread name/content, then "refresh" the page from the browser navigation bar, then the thread name/content is re-entered. I've played with this tons to no avail. Any suggestions???

----


Revision [4731]

Edited on 2005-01-17 14:30:29 by NilsLindenberg [cat. changed]
Additions:
CategoryUserContributions
Deletions:
CategoryDevelopment


Revision [4587]

Edited on 2005-01-13 05:15:32 by GmBowen [updating code to add wikka formatting to forum body text.....]
Additions:
// **NOTE** for inclusion on a wiki page double percents were replaced by #0025 on line 154, they need
// to be replaced as double percents. It is not advised that you do not replace code formatting marks.
$remove = array('#%', '======', '=====', '====', '===', '==', '[[', ']]', '||', '#0025#0025', '<<', '>>', '::c::', '""');
Deletions:
$remove = array('#%', '======', '=====', '====', '===', '==', '[[', ']]', '||', '#0025&#0025', '<<', '>>', '::c::', '""');


Revision [4586]

Edited on 2005-01-13 05:05:53 by GmBowen [updating code to add wikka formatting to forum body text.....]
Additions:
$remove = array('#%', '======', '=====', '====', '===', '==', '[[', ']]', '||', '#0025&#0025', '<<', '>>', '::c::', '""');
Deletions:
$remove = array('#%', '======', '=====', '====', '===', '==', '[[', ']]', '||', '%%', '<<', '>>', '::c::', '""');


Revision [4585]

Edited on 2005-01-13 04:58:36 by GmBowen [addition of wikka formatting capability for messages]
Additions:
// wikkaforum.php Version 1.0j - Jan 13, 2005 - placed navigational links above entry box. Added variable to function call.
$forum->Show_frm($forum->ptitle, $link, $_GET['wid']);
// wikkaforumfunctions.php Version 1.0i - Jan 13, 2005 - added several wikka formatting features to forum output
// USE: required to be able to use wikkaforum.php & forumcounter.php actions.
function Show_frm($ptitle=NULL, $link, $wid) {
$showrules="";
if (!EMPTY($wid)){$showrules="<small>Except in titles, several wiki formatting codes (bold(<bold>**</bold>), italics(<strong>//</strong>), underline(<strong>__</strong>),<br /> strikethrough(<strong>++</strong>), highlight (two single quotes...<strong>''</strong>), centering (<strong>@@</strong>) and bulleted lists(<strong>~-</strong>) <br />(and other lists)) are active. Headings, actions, tables, and external linking are not activated. </small>";}
. "</tr><tr><td></td><td>".$showrules."</td></tr></TABLE>\n"
global $wakka;
$printtext = (stripslashes($row['for_text']));
$brackets = Array ('/{{/i', '/}}/i');
$changeto = '|.|';
$printtext = preg_replace($brackets, $changeto, $printtext);
$remove = array('#%', '======', '=====', '====', '===', '==', '[[', ']]', '||', '%%', '<<', '>>', '::c::', '""');
$printtext = str_replace($remove, '', $printtext);
$printtext = $wakka->format($printtext);
print("<hr>".$printtext."<br><br></TD></tr>\n\n");
Deletions:
// wikkaforum.php Version 1.0i - Jan 10, 2005 - updated navigation menu look by adding "main" parameter, corrected link
$forum->Show_frm($forum->ptitle, $link);
// wikkaforumfunctions.php Version 1.0h - Jan 10 2005 - added counter function, corrected data output
// USE: required to use wikkaforum.php action.
function Show_frm($ptitle=NULL, $link) {
. "</tr></TABLE>\n"
$this->text = nl2br(stripslashes($row['for_text']));
print("<hr>".$this->text."<br><br></TD></tr>\n\n");


Revision [4404]

Edited on 2005-01-11 03:39:31 by GmBowen [minor correction of function by class author]
Additions:
// wikkaforumfunctions.php Version 1.0h - Jan 10 2005 - added counter function, corrected data output
// MODIFIED from SForum class V1.4 for use in wikka wiki by GmBowen for a SSHRC research project.
$row['for_name'] = "Guest";
print("<tr ALIGN='left'><TD>$link2<A HREF=\"".$link."&wid=".$row['id']."\">".$this->ptitle."</A></TD><TD ALIGN=\"center\">Replies: ".$this->react."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_name']."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_dataw']."</TD></tr>\n\n");
$row['for_name'] = "Guest";
Deletions:
// wikkaforumfunctions.php Version 1.0g - Jan 10 2005 - added counter function
$row['for_name'] = "Gość";
print("<tr ALIGN='left'><TD>$link2<A HREF=\"".$link."&wid=".$row['id']."\">".$this->ptitle."</A></TD><TD ALIGN=\"center\">Replies: ".$this->react."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_name']."</TD><TD ALIGN=\"center\" WIDTH=\"20%\">".$row['for_data']."</TD></tr>\n\n");
$row['for_name'] = "Gość";


Revision [4397]

Edited on 2005-01-10 23:54:52 by GmBowen [corrected time sort order in forumcounter]
Additions:
// forumcounter.php Version 1.0b - Jan 10, 2005 - corrected time sort order
$tablepgname = $this->LoadAll("SELECT * FROM ".$this->config['table_prefix']."wikkaforum WHERE tag='".$tag."' ORDER BY for_data DESC LIMIT 0,1");
foreach($tablepgname as $ltime)
{
echo "<small>  Last edit: ".$ltime["for_data"]."]</small>";
Deletions:
// forumcounter.php Version 1.0 - Jan 10, 2005 - initial release
$tablepgname = $this->LoadSingle("SELECT * FROM ".$this->config['table_prefix']."wikkaforum WHERE tag='".$tag."' LIMIT 1");
echo "<small>  Last edit: ".$tablepgname[for_data]."]</small>";


Revision [4395]

Edited on 2005-01-10 22:31:41 by GmBowen [logic loop problem....even when ya think you've tested everything :), corrected image link]
Additions:
http://gmbowen.educ.unb.ca/wikitest/forumcounter.jpg


Revision [4394]

Edited on 2005-01-10 22:30:06 by GmBowen [logic loop problem....even when ya think you've tested everything :)]
Additions:
// wikkaforum.php Version 1.0i - Jan 10, 2005 - updated navigation menu look by adding "main" parameter, corrected link
if (empty($topic) && ($page!=$this->getPageTag())) {$topic=$tag;}
if (empty($topic) && ($page!=$this->getPageTag())) {$topic=$tag;}
Deletions:
// wikkaforum.php Version 1.0h - Jan 10, 2005 - updated navigation menu look by adding "main" parameter, corrected link
if (empty($topic)) {
if ($page!=$this->getPageTag()){$topic=$page; ;}
}}
if (empty($topic)) {$topic=$this->MiniHref($method, $tag);}


Revision [4390]

Edited on 2005-01-10 21:46:26 by GmBowen [forumcounter action added, update of other files w/ nav menus]
Additions:
Often one finds wiki's used as adjuncts to other tools....discussion forums for instance. In those forums the main topic threads are determined by the administrator(s) and out of the hands of most of the users. Wiki's, such as Wikka, are meant to provide considerable flexibility for the users and place the control in their hands. At the same time, this freedom can lead to very unstructured and difficult to follow discussions. Below is code for a forum tool that allows an individual user to set up a structured forum thread on **any** page. The page owner can control the contributers to the forum discussions, or leave it open for all to participate. Apart from this, it's easier to set up the wiki & registration into it with a forum tool that can be used in the wiki than it is to set up both a wiki & a forum (plus, there's consistency in registration names). Forums created on one page can be viewed on another (but not edited). A forumcounter action allows seeing the contributions to any particular forum.
As an example, see my [[http://131.202.167.33/3511forum/ original forum]] for one of my courses and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tools. Almost identical functionality, and the wiki one was **considerably** faster and easier to set up. Additionally, I can add comments and links FAR more easily on individual forum pages in the clone than I ever could in the real forum software. Once I can get a private message system completed (see [[http://gmbowen.educ.unb.ca/wiki/wakka.php?wakka=Mailbox here]]) then I'll use this forum approach for courses instead of an actual forum since I'll have all the needed functionality and more in one spot...and that's even more true when we get simple table formatting (hint hint), etc. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")
The //wikkaforum// action allows you to open the discussion threads on any page using ""{{wikkaforum page="pagename"}}"", although entries cannot be made anywhere but the home page (for security reasons). The page owner can designate a user list and a topic title (example: ""{{wikkaforum share="JavaWoman DarTar GmBowen" topic="Paged Comments"}}"") or leave the discussion threads open to all users. If a "collection" of threads is made (see my course clone example) then a main="collectionpage" designation can be made and that will be added to the navigation system automatically. The //forumcounter// action allows one to designate a particular thread and determine the number of threads and, optionally, time of last contribution.
// wikkaforum.php Version 1.0h - Jan 10, 2005 - updated navigation menu look by adding "main" parameter, corrected link
if (empty($topic)) {
if ($page!=$this->getPageTag()){$topic=$page; ;}
else{
$topic=$this->MiniHref($method, $tag);
}}
// wikkaforumfunctions.php Version 1.0g - Jan 10 2005 - added counter function
// Show_ForumCount: Displays the count of the number of threads
function Show_SForumCounter($tag, $prefix) {
//number of reactions
$this->react=$row1['num'];
$count=$count + 1;
}
echo "<small>[# of threads:".$count.$row['for_data']."</small>";
}else{
echo "<small>[# of threads: 0</small>";
This final action should be called ##forumcounter.php## and placed in the actions directory.
// forumcounter.php Version 1.0 - Jan 10, 2005 - initial release
// PURPOSE - Counts number of threads in specific forum (each forum is associated w/ a specific page)
// USE: {{forumcounter [page="forumpage"] [last="yes"]}} provides a count of the number of threads
// in the forum on the designated page (default is current page).
// last="yes" designates that the last time/date a thread was contributed to is desired.
// REQUIRES wikkaforumfunctions.php to be included in a directory in wikka root called "scripts"
if (empty($page)) {$page=$this->getPageTag();}
$tag=$page;
// CLASS STATEMENT STARTS HERE. Using include_once prevents function conflicts
// & allows multiple instances on the same page
if (!isset($_GET['wid'])) {
$forum->Show_SForumCounter($tag, $prefix);
$last=(strtolower($last));
if ($last=="yes"){
$tablepgname = $this->LoadSingle("SELECT * FROM ".$this->config['table_prefix']."wikkaforum WHERE tag='".$tag."' LIMIT 1");
echo "<small>  Last edit: ".$tablepgname[for_data]."]</small>";
}else{
echo "<small>]</small>";
The "main page" of wikkaforum looks like this.....
and the threads look like this....
if you have a collection of forum pages you can use wiki formatting to emulate the front end of "real" forum software (demonstrated with the ##forumcounter.php## code being used)
Deletions:
Often one finds wiki's used as adjuncts to other tools....discussion forums for instance. In those forums the main topic threads are determined by the administrator(s) and out of the hands of most of the users. Wiki's, such as Wikka, are meant to provide considerable flexibility for the users and place the control in their hands. At the same time, this freedom can lead to very unstructured and difficult to follow discussions. Below is code for a forum tool that allows an individual user to set up a structured forum thread on any page. The page owner can control the contributers to the forum discussions, or leave it open for all to participate. Apart from this, it's easier to set up the wiki & registration into it with a forum tool than to set up both a wiki & a forum.
As an example, see my [[http://131.202.167.33/3511forum/ original forum]] for one of my courses and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tool. Almost identical functionality, and the wiki one was **considerably** faster and easier to set up. Additionally, I can add comments and links FAR more easily on individual forum pages in the clone than I ever could in the real forum software....and things are far easier to edit. Once I can get a private message system done (see [[http://gmbowen.educ.unb.ca/wiki/wakka.php?wakka=Mailbox here]]) then I'll use this forum approach for courses instead of an actual forum since I'll have all the needed functionality and more in one spot...and that's even more true when we get simple table formatting (hint hint), etc. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")
The action allows you to open the discussion threads on any page using ""{{wikkaforum page="pagename"}}"", although entries cannot be made anywhere but the home page (for security reasons). The page owner can designate a user list and a topic title (example: ""{{wikkaforum share="JavaWoman DarTar GmBowen" topic="Paged Comments"}}"") or leave the discussion threads open to all users.
// wikkaforum.php Version 1.0f - Jan 10, 2005 - updated navigation menu look by adding "main" parameter
// wikkaforumfunctions.php Version 1.0f - Jan 10 2005 - updated function, added function
The "main page" looks like this.....
and the threads look like this (new navigation menus not present)....


Revision [4382]

Edited on 2005-01-10 17:16:27 by GmBowen [updated navigation menu functionality/look, updated/added functions]
Additions:
// wikkaforum.php Version 1.0f - Jan 10, 2005 - updated navigation menu look by adding "main" parameter
// Use: {{wikkaforum [topic="topic description"] [main="mainpage"] [page="pagename"] [share="name1 name2 name3 etc"]}}
// "main" is used if there is a collection of threads accessed from one wiki page, "main" allows the user
// to easily return to that page by placing a link on the page automatically
//{{wikkaforum main="WikkaForum" topic="Bakhtin"}}
* @author: Wojciech Napierala XII.2004
if ($main==""){
if (!empty($_GET['wid'])) {
echo "  <A HREF=\"".$link."\"><small>Return to Thread List</small></A>\n";
print("<br>\n");
else {
echo "<A HREF=\"".$link."\"><small>  </small></A>\n";
print("<br>\n");
if ($this->IsWikiName($main)) {$link2 = "<A HREF=\"".$this->config["base_url"].$main."\">".$main."</A>";}
else {
echo $main;
if (!empty($_GET['wid'])) {$joiner=">>";}
if (empty($topic)) {$topic=$this->MiniHref($method, $tag);}
echo $link2.">><A HREF=\"".$link."\">".$topic."</A>".$joiner;
$forum->Show_SForum_Thread_Name($_GET['wid'], $tag, $prefix);
if ($main==""){
if (!empty($_GET['wid'])) {
echo "  <A HREF=\"".$link."\"><small>Return to Thread List</small></A>\n";
print("<br>\n");
else {
echo "<A HREF=\"".$link."\"><small>  </small></A>\n";
print("<br>\n");
if ($this->IsWikiName($main)) {$link2 = "<A HREF=\"".$this->config["base_url"].$main."\">".$main."</A>";}
else {
echo $main;
if (!empty($_GET['wid'])) {$joiner=">>";}
if (empty($topic)) {$topic=$this->MiniHref($method, $tag);}
echo $link2.">><A HREF=\"".$link."\">".$topic."</A>".$joiner;
$forum->Show_SForum_Thread_Name($_GET['wid'], $tag, $prefix);
// wikkaforumfunctions.php Version 1.0f - Jan 10 2005 - updated function, added function
// USE: required to use wikkaforum.php action.
// This file **must** be placed in a directory in wikka root called "scripts".
// Original Simple Forum class available from www.phpclasses.org
// Add_new_post: Adds new record to DB (updated 10 Jan 2005)
if($ptitle=="" or $text==""){
return;
print("<br> There are no threaded topics yet. Why don't you start one?<br>\n");
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
// Show_SForum_Thread_Name: Displays all messages of a thread
function Show_SForum_Thread_Name($wid, $tag, $prefix) {
$zapytanie = "SELECT for_ptitle FROM ".$prefix."wikkaforum WHERE id='$wid' AND tag='$tag' LIMIT 0,1";
print($this->ptitle);
and the threads look like this (new navigation menus not present)....
- an action that could be placed on the forum main page (see my clone example) that could indicate if you'd contributed to that wikkaforum.
Deletions:
// wikkaforum.php Version 1.0e
// Use: {{wikkaforum [topic="topic description"] [page="pagename"] [share="name1 name2 name3 etc"]}}
echo "  <A HREF=\"".$link."\"><small>Return to Front Menu</small></A>\n";
print("<br>\n");
echo "  <A HREF=\"".$link."\"><small>Return to Front Menu</small></A>\n";
// wikkaforumfunctions.php Version 1.0e
// Use: required to use wikkaforum.php action. This file must be placed in a file in wikka root called "scripts".
// Add_new_post: Adds new record to DB
print(" There are no threaded topics yet. Why don't you start one?<br>\n");
$zapytanie = "SELECT * FROM ".$prefix."wikkaforum WHERE id='$wid' LIMIT 0,1";
and the threads look like this....
- an action that could be used to placed on the forum main page (see my clone example) that could indicate if you'd contributed to that wikkaforum.


Revision [4360]

Edited on 2005-01-10 03:30:06 by GmBowen [fix tpyo]

No Differences

Revision [4200]

Edited on 2005-01-07 15:27:05 by GmBowen [tpyo & code/files altered to prevent function conflicts (yay!!..thanks JW)]
Additions:
// CLASS STATEMENT STARTS HERE. Using include_once prevents function conflicts & allows multiple instances on the same page
// CLASS STATEMENT ENDS HERE.
Deletions:
// CLASS STATEMENT STARTS HERE. IF YOU WANT TO MOVE THIS CODE TO WAKKA.PHP then you can have multiple
// instances of the action on one page. Insert the code below where CLASS WAKKA ends in wakka.php
// which is immediately before "// stupid version check".
// CLASS STATEMENT ENDS HERE


Revision [4199]

Edited on 2005-01-07 15:25:31 by GmBowen [code/files altered to prevent function conflicts (yay!!..thanks JW)]
Additions:
// wikkaforum.php Version 1.0e
// MODIFIED from SForum class V1.2 for use in wikka wiki by GmBowen for a SSHRC research project.
// The file wikkaforumfunctions.php MUST be included in a directory in wikka root called "scripts"
include_once("./scripts/wikkaforumfunctions.php");
The following file contains the functions for ##wikkaforum.php## and must be saved in a file called ##wikkaforumfunctions.php## and stored in a directory called ##scripts## placed in the wikka root. (Thanks to JW to steering me towards this approach!!)
// wikkaforumfunctions.php Version 1.0e
// Use: required to use wikkaforum.php action. This file must be placed in a file in wikka root called "scripts".
// MODIFIED from SForum class V1.2 for use in wikka wiki by GmBowen for a SSHRC research project.
Deletions:

**NOTE:** as with almost any action with its own functions, placing this action twice on the same page causes conflicts that "break" the page. As a consequence, the "history" & "revisions" feature will not work because of this. There are many options. One is to use the action code on my home page (GmBowen) to automatically erase page history. Another option, as pointed out by Nils (thanks Nils) and which I suspected was also a solution, is to place the function code into wikka.php (this is the ultimate solution and would allow placing multiple versions on the same page). > > UPDATE: I have now tested and refined the code so that adding the function class into wikka.php allows you to have multiple instances of the action on the same page without any conflict. Minor code modifications were necessary and are now implemented. < < If you do not want to edit wakka.php you're restricted to one instance of the action per page. The **preferred** solution to the problem with showing history & revisions relies on solutions proposed by DarTar and Nils (thanks guys!!). DarTar suggested adding a couple of code lines...one above my code & one below (now implemented) so that the wikkaforum action does not show up in history or revisions at all. Nils then suggested the following change to ##formatter/wakka.php## which would have the actions shown as text only & are not enacted....
To have the action code now show up in history & revisions (after DarTar's suggestion) one would need to implement the following change to ##formatter/wakka.php##:
// Actions
else if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches))
to
// Actions
else if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches) && ($wakka->method == 'show'))
''This will have the effect, that, in any mode except "show", you will only see ""{{actionname}}"" instead of the action being interpreted.'' --NilsLindenberg
~''This looks like the cleanest and - more importantly - most generic solution to me. --JavaWoman''
If anybody has any other suggestions how this could be avoided that involves less "hacking" please feel free to propose them. Code that would halt an action being implemented if the functions already existed in another action would be really useful....is this possible??
// wikkaforum.php Version 1.0d
// MODIFIED from SForum class V1.2 for use in wikka wiki
// by GmBowen for a SSHRC research project.
// Instructions below on how to move to wakka.php so that multiple instances of the action
// are possible on a single page. (this allows "showing" multiple forums from other pages)
if ($this->method == "show") {
<? } ?>


Revision [4048]

Edited on 2005-01-06 02:43:47 by GmBowen [updated code & commentary to support inclusion of functions in wikka.php]
Additions:
**NOTE:** as with almost any action with its own functions, placing this action twice on the same page causes conflicts that "break" the page. As a consequence, the "history" & "revisions" feature will not work because of this. There are many options. One is to use the action code on my home page (GmBowen) to automatically erase page history. Another option, as pointed out by Nils (thanks Nils) and which I suspected was also a solution, is to place the function code into wikka.php (this is the ultimate solution and would allow placing multiple versions on the same page). > > UPDATE: I have now tested and refined the code so that adding the function class into wikka.php allows you to have multiple instances of the action on the same page without any conflict. Minor code modifications were necessary and are now implemented. < < If you do not want to edit wakka.php you're restricted to one instance of the action per page. The **preferred** solution to the problem with showing history & revisions relies on solutions proposed by DarTar and Nils (thanks guys!!). DarTar suggested adding a couple of code lines...one above my code & one below (now implemented) so that the wikkaforum action does not show up in history or revisions at all. Nils then suggested the following change to ##formatter/wakka.php## which would have the actions shown as text only & are not enacted....
~''This looks like the cleanest and - more importantly - most generic solution to me. --JavaWoman''
// wikkaforum.php Version 1.0d
// MODIFIED from SForum class V1.2 for use in wikka wiki
// Instructions below on how to move to wakka.php so that multiple instances of the action
// are possible on a single page. (this allows "showing" multiple forums from other pages)
$pageX=$tag;
if(empty($share)){$share = 'ALL';}
if (strtoupper($this->GetUserName())==strtoupper($this->GetPageOwner())){$use = 'true';}
// check so that when there are multiple instances of the action one cannot "add" to the database
// in response to having a thread from another page open (trust me, this code is necessary)
$tablepgname = $this->LoadSingle("SELECT tag FROM ".$this->config['table_prefix']."wikkaforum WHERE wid='".$_GET['wid']."' LIMIT 0,1");
$shouldwrite = $tablepgname[tag];
if (($shouldwrite==$this->getPageTag()) || (empty($shouldwrite))) {$use2 = 'true';}
// CLASS STATEMENT STARTS HERE. IF YOU WANT TO MOVE THIS CODE TO WAKKA.PHP then you can have multiple
// instances of the action on one page. Insert the code below where CLASS WAKKA ends in wakka.php
// which is immediately before "// stupid version check".
print(" There are no threaded topics yet. Why don't you start one?<br>\n");
print("   No threads(s) exist for this topic.<br>\n");
// CLASS STATEMENT ENDS HERE
if (!empty($_POST['frm_ptitle']))
if(empty($page))
$forum->Add_new_post($_POST['frm_ptitle'],$_POST['frm_text'],$tag,$_POST['frm_ip'],$username,$_POST['frm_wid'],$prefix);
if ($pageX==$this->getPageTag())
if ($use == 'true')
if(empty($page))
{
if ($use2 == 'true')
{
$forum->Show_frm($forum->ptitle, $link);
}
}
if ($pageX!=$this->getPageTag()){print("<small>  This forum originates from ".$pageX.".</small><br>");}
Deletions:
**NOTE:** as with almost any action with its own functions, placing this action twice on the same page causes conflicts that "break" the page. As a consequence, the "history" feature will not work because of this. There are many options. One is to use the action code on my home page (GmBowen) to automatically erase page history. Another option, as pointed out by Nils (thanks Nils) and which I suspected was also a solution, is to place the function code into wikka.php (this is the ultimate solution and would allow placing multiple versions on the same page). The **preferred** solution to the problem with showing history & revisions relies on solutions proposed by DarTar and Nils (thanks guys!!). DarTar suggested adding a couple of code lines...one above my code & one below (now implemented). Nils suggested the following change to ##formatter/wakka.php##....
~''This looks like the cleanest and - more importantly - most generic solution to me. --JavaWoman''
// wikkaforum.php Version 1.0c
// NOTE THAT ONLY ONE COPY OF THIS CODE SHOULD BE PLACED ON ANY ONE PAGE
// MODIFIED from SForum class V1.2 for use in wikka wiki
// Contributions by DarTar & NilsLindenberg for effective implementation into wikka
$page=$tag;
if(strtoupper($this->GetUserName()) == strtoupper($this->GetPageOwner())){ $use = 'true';}
if (empty($share)){$use='true';}
print("No threads<br>\n");
print("No threads<br>\n");
// Main_page: Show back-to-main link
function Main_page($link) {
print("<A HREF=\"".$link."\">Go to Main Page</A>\n");
if (!empty($_POST['frm_ptitle'])){
$forum->Add_new_post($_POST['frm_ptitle'],$_POST['frm_text'],$tag,$_POST['frm_ip'],$username,$_POST['frm_wid'],$prefix);
if ($page==$this->getPageTag())
if ($use == 'true')
$forum->Show_frm($forum->ptitle, $link);
if ($page!=$this->getPageTag()){print("<small>  This forum originates from ".$page.".</small><br>");}


Revision [4027]

Edited on 2005-01-05 21:45:47 by JavaWoman [comment about history/revision solution]
Additions:
''This will have the effect, that, in any mode except "show", you will only see ""{{actionname}}"" instead of the action being interpreted.'' --NilsLindenberg
~''This looks like the cleanest and - more importantly - most generic solution to me. --JavaWoman''
Deletions:
''This will have the effect, that, in any mode except "show", you will only see ""{{actionname}}"" instead of the action being interpreted.'' --NilsLindenberg


Revision [4021]

Edited on 2005-01-05 20:31:19 by GmBowen [minor code update]
Additions:
// wikkaforum.php Version 1.0c
if (empty($share)){$use='true';}
Deletions:
// wikkaforum.php Version 1.0b


Revision [4019]

Edited on 2005-01-05 19:23:23 by GmBowen [further notes on utility & use & to-do addition]
Additions:
- if you enter a thread name/content, then "refresh" the page from the browser navigation bar, then the thread name/content is re-entered. I've played with this tons to no avail. Any suggestions???


Revision [4018]

Edited on 2005-01-05 18:42:24 by GmBowen [further notes on utility & use]
Additions:
Often one finds wiki's used as adjuncts to other tools....discussion forums for instance. In those forums the main topic threads are determined by the administrator(s) and out of the hands of most of the users. Wiki's, such as Wikka, are meant to provide considerable flexibility for the users and place the control in their hands. At the same time, this freedom can lead to very unstructured and difficult to follow discussions. Below is code for a forum tool that allows an individual user to set up a structured forum thread on any page. The page owner can control the contributers to the forum discussions, or leave it open for all to participate. Apart from this, it's easier to set up the wiki & registration into it with a forum tool than to set up both a wiki & a forum.
As an example, see my [[http://131.202.167.33/3511forum/ original forum]] for one of my courses and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tool. Almost identical functionality, and the wiki one was **considerably** faster and easier to set up. Additionally, I can add comments and links FAR more easily on individual forum pages in the clone than I ever could in the real forum software....and things are far easier to edit. Once I can get a private message system done (see [[http://gmbowen.educ.unb.ca/wiki/wakka.php?wakka=Mailbox here]]) then I'll use this forum approach for courses instead of an actual forum since I'll have all the needed functionality and more in one spot...and that's even more true when we get simple table formatting (hint hint), etc. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")
Deletions:
Often one finds wiki's used as adjuncts to other tools....discussion forums for instance. In those forums the main topic threads are determined by the administrator(s) and out of the hands of most of the users. Wiki's, such as Wikka, are meant to provide considerable flexibility for the users and place the control in their hands. At the same time, this freedom can lead to very unstructured and difficult to follow discussions. Below is code for a forum tool that allows an individual user to set up a structured forum thread on any page. The page owner can control the contributers to the forum discussions, or leave it open for all to participate. Apart from this, it's easier to set up the wiki & registration into it with a forum tool than to set up both a wiki & a forum. As an example, see my [[http://131.202.167.33/3511forum/ original forum]] for a course and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tool. Almost identical functionality, and the wiki one was considerably faster and easier to set up. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")


Revision [4016]

Edited on 2005-01-05 17:41:24 by GmBowen [to-do/further development list (tpyo)]
Additions:
- search feature for forum table...for both individual wikkaforum & all wikkaforum's?
Deletions:
- search feature for forum table...for both individual thread & all wikkaforum's?


Revision [4015]

Edited on 2005-01-05 17:40:37 by GmBowen [to-do/further development list]
Additions:



Revision [4014]

Edited on 2005-01-05 17:39:59 by GmBowen [to-do/further development list]
Additions:
- search feature for forum table...for both individual thread & all wikkaforum's?
- list your contributions (add to code above so can just click on a link & show your comments & replies)...or maybe just put a "star" or something beside the threadnames (on the front page) that you've contributed to?
- an action that could be used to placed on the forum main page (see my clone example) that could indicate if you'd contributed to that wikkaforum.
Deletions:
- search feature for forum table...for both individual thread & all wikkaforum's
- list your contributions (add to code above so can just click on a link & show your comments & replies)...or maybe just put a "star" or something beside the threadnames (on the front page) that you've contributed to? Then could develop an action that could be used to place the same thing on the forum main page.


Revision [4013]

Edited on 2005-01-05 17:38:36 by GmBowen [to-do/further development list]
Additions:
To Do/Further Development list:
- search feature for forum table...for both individual thread & all wikkaforum's
- list your contributions (add to code above so can just click on a link & show your comments & replies)...or maybe just put a "star" or something beside the threadnames (on the front page) that you've contributed to? Then could develop an action that could be used to place the same thing on the forum main page.


Revision [4012]

Edited on 2005-01-05 17:06:12 by GmBowen [update on code & implementation instructions based on feedback]
Additions:
**NOTE:** as with almost any action with its own functions, placing this action twice on the same page causes conflicts that "break" the page. As a consequence, the "history" feature will not work because of this. There are many options. One is to use the action code on my home page (GmBowen) to automatically erase page history. Another option, as pointed out by Nils (thanks Nils) and which I suspected was also a solution, is to place the function code into wikka.php (this is the ultimate solution and would allow placing multiple versions on the same page). The **preferred** solution to the problem with showing history & revisions relies on solutions proposed by DarTar and Nils (thanks guys!!). DarTar suggested adding a couple of code lines...one above my code & one below (now implemented). Nils suggested the following change to ##formatter/wakka.php##....
To have the action code now show up in history & revisions (after DarTar's suggestion) one would need to implement the following change to ##formatter/wakka.php##:
''This will have the effect, that, in any mode except "show", you will only see ""{{actionname}}"" instead of the action being interpreted.'' --NilsLindenberg
If anybody has any other suggestions how this could be avoided that involves less "hacking" please feel free to propose them. Code that would halt an action being implemented if the functions already existed in another action would be really useful....is this possible??
// wikkaforum.php Version 1.0b
// NOTE THAT ONLY ONE COPY OF THIS CODE SHOULD BE PLACED ON ANY ONE PAGE
// Contributions by DarTar & NilsLindenberg for effective implementation into wikka
if ($this->method == "show") {
Deletions:
**NOTE:** as with almost any action with its own functions, placing this action twice on the same page causes conflicts that "break" the page. As a consequence, the "history" feature will not work because of this. There are two options. One is to use the action code on my home page (GmBowen) to automatically erase page history, the other is to edit the history.php file as indicated at GmBowenWikkaAsPIM so that the ""{{}}"" are replaced with ""|| ||"" in displaying history (I think this is a better approach for history anyways...to see code and not formatting). Another option, as pointed out by Nils (thanks Nils) and which I suspected was also a solution, is to place the function code into wikka.php. If anybody has any other suggestions how this could be avoided that involves less "hacking" (like, something I could do with the code below) please feel free to propose it.
DarTar suggests adding a couple of code lines...one above my code & one below. If you do this AND do the replacement of ""{{}}"" with ""|| ||"" (as detailed at GmBowenWikkaAsPIM) then you can see the code entries in history AND the revision feature doesn't break (it just doesn't show any of the code involving ""{{wikkaforum}}""). I'd suggest doing both myself, although if you just do DarTar's then both history & revisions are fine (but you never see what ""{{wikkaforum}}"" code was entered/altered). THANKS for the suggestion DarTar.
if ($this->method == "show") {
****my code below****
...
****my code above****
''Another solution would be the following change to ##formatter/wakka.php##:''
''This will have the effect, that, in any mode except "show", you will only see ""{{actionname}}"" instead of the action beeing interpreted.'' --NilsLindenberg
// wikkaforum.php Version 1.0


Revision [4010]

Edited on 2005-01-05 16:22:11 by NilsLindenberg [closing note]
Additions:
''This will have the effect, that, in any mode except "show", you will only see ""{{actionname}}"" instead of the action beeing interpreted.'' --NilsLindenberg
Deletions:
''This will have the effect, that, in any mode except "show", you will only see ""{{actionname}}"" instead of the action beeing interpreted. --NilsLindenberg


Revision [4009]

Edited on 2005-01-05 16:21:44 by NilsLindenberg [another solution]
Additions:
''Another solution would be the following change to ##formatter/wakka.php##:''
// Actions
else if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches))
to
// Actions
else if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches) && ($wakka->method == 'show'))
''This will have the effect, that, in any mode except "show", you will only see ""{{actionname}}"" instead of the action beeing interpreted. --NilsLindenberg


Revision [4008]

Edited on 2005-01-05 16:06:55 by GmBowen [an example of wikkaforum contrasted with a "real" forum]
Additions:
Often one finds wiki's used as adjuncts to other tools....discussion forums for instance. In those forums the main topic threads are determined by the administrator(s) and out of the hands of most of the users. Wiki's, such as Wikka, are meant to provide considerable flexibility for the users and place the control in their hands. At the same time, this freedom can lead to very unstructured and difficult to follow discussions. Below is code for a forum tool that allows an individual user to set up a structured forum thread on any page. The page owner can control the contributers to the forum discussions, or leave it open for all to participate. Apart from this, it's easier to set up the wiki & registration into it with a forum tool than to set up both a wiki & a forum. As an example, see my [[http://131.202.167.33/3511forum/ original forum]] for a course and the wiki-based [[http://gmbowen.educ.unb.ca/wikitxt/wakka.php?wakka=WikkaForum clone of the forum]] using the forum tool. Almost identical functionality, and the wiki one was considerably faster and easier to set up. (for those of you that notice that the original forum had "anonymous" contributions, it will be **substantially** easier to change the code in ""{{wikkaforum}}"" to accomplish that so that names are only shown to admin than it was in the code for ""PunBB"")
Deletions:
Often one finds wiki's used as adjuncts to other tools....discussion forums for instance. In those forums the main topic threads are determined by the administrator(s) and out of the hands of most of the users. Wiki's, such as Wikka, are meant to provide considerable flexibility for the users and place the control in their hands. At the same time, this freedom can lead to very unstructured and difficult to follow discussions. Below is code for a forum tool that allows an individual user to set up a structured forum thread on any page. The page owner can control the contributers to the forum discussions, or leave it open for all to participate.


Revision [4005]

Edited on 2005-01-05 15:25:37 by GmBowen [elaboration on DarTar's suggestion & more specific code]
Additions:
DarTar suggests adding a couple of code lines...one above my code & one below. If you do this AND do the replacement of ""{{}}"" with ""|| ||"" (as detailed at GmBowenWikkaAsPIM) then you can see the code entries in history AND the revision feature doesn't break (it just doesn't show any of the code involving ""{{wikkaforum}}""). I'd suggest doing both myself, although if you just do DarTar's then both history & revisions are fine (but you never see what ""{{wikkaforum}}"" code was entered/altered). THANKS for the suggestion DarTar.
Deletions:
DarTar suggests adding a couple of code lines...one above my code & one below. If you this AND do the replacement of ""{{}}"" with ""|| ||"" (as detailed at GmBowenWikkaAsPIM) then you can see the code entries in history AND the revision feature doesn't break (it just doesn't show any of the code involving ""{{wikkaforum}}"". I'd suggest doing both myself, although if you just do DarTar's then both history & revisions are fine (but you never see what ""{{wikkaforum}}"" code was entered/altered). THANKS for the suggestion DarTar.


Revision [4004]

Edited on 2005-01-05 15:24:36 by GmBowen [elaboration on DarTar's suggestion to avoid history/revision conflicts]
Additions:
DarTar suggests adding a couple of code lines...one above my code & one below. If you this AND do the replacement of ""{{}}"" with ""|| ||"" (as detailed at GmBowenWikkaAsPIM) then you can see the code entries in history AND the revision feature doesn't break (it just doesn't show any of the code involving ""{{wikkaforum}}"". I'd suggest doing both myself, although if you just do DarTar's then both history & revisions are fine (but you never see what ""{{wikkaforum}}"" code was entered/altered). THANKS for the suggestion DarTar.
****my code below****
****my code above****
Deletions:
''Mike, an easy workaround to prevent problems with handlers like ##history## is to restrict the action output to the ##show## method. Just wrap all your code in a block like the following:''
// here goes your code
}
''Hope this helps -- DarTar''
Do you mean like....???
echo $prefix;


Revision [4003]

Edited on 2005-01-05 14:49:03 by GmBowen [query to DarTar]
Additions:
Do you mean like....???
...
<? } ?>


Revision [3999]

Edited on 2005-01-05 09:21:49 by DarTar [How to address history problem]
Additions:
{{lastedit}}
http://gmbowen.educ.unb.ca/wikitest/discussionforum2.jpg
----
CategoryDevelopment
Deletions:
http://gmbowen.educ.unb.ca/wikitest/discussionforum2.jpg


Revision [3998]

Edited on 2005-01-05 09:20:02 by DarTar [Avoiding history problem]
Additions:
''Mike, an easy workaround to prevent problems with handlers like ##history## is to restrict the action output to the ##show## method. Just wrap all your code in a block like the following:''
if ($this->method == "show") {
// here goes your code
}
''Hope this helps -- DarTar''
http://gmbowen.educ.unb.ca/wikitest/discussionforum2.jpg
Deletions:
http://gmbowen.educ.unb.ca/wikitest/discussionforum2.jpg


Revision [3991]

Edited on 2005-01-05 07:22:54 by GmBowen [minor update of initial release of a mini-discussion forum]
Additions:
**NOTE:** as with almost any action with its own functions, placing this action twice on the same page causes conflicts that "break" the page. As a consequence, the "history" feature will not work because of this. There are two options. One is to use the action code on my home page (GmBowen) to automatically erase page history, the other is to edit the history.php file as indicated at GmBowenWikkaAsPIM so that the ""{{}}"" are replaced with ""|| ||"" in displaying history (I think this is a better approach for history anyways...to see code and not formatting). Another option, as pointed out by Nils (thanks Nils) and which I suspected was also a solution, is to place the function code into wikka.php. If anybody has any other suggestions how this could be avoided that involves less "hacking" (like, something I could do with the code below) please feel free to propose it.


Revision [3990]

The oldest known version of this page was created on 2005-01-05 07:11:23 by GmBowen [minor update of initial release of a mini-discussion forum]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki