====== Discussion MediaWiki-Style ====== As I wanted to have a discussion-function such as Wikipedia provides, I mangled around with the source-code of lib/tpl/mytemplate/main.php, the file which usually is only about layouting your template. It creates a **link from yournamespace:pageX to discussion:yournamespace:pageX** and backwards of course. I tried hard to make the necessary changes to * conf/local.php: $conf['discuss']=1 - set 0 to disable discussion-feature * inc/common.php or inc/template.php (where?) to add function discuss * inc/lang/[en|de]/lang.php with the necessary 3 localization strings * inc/template.php to create actionlink and html_button for function discuss * lib/tpl/default/main.php to give an example place for button/link to discussion page I failed. ;) What I got is a working function that I included directly to main.php. If you desperately waited for this feature, feel free to use it. If you think, this feature should be included to DokuWiki's next version, feel free to do so or if you aren't able (as I am not) at least leave a little comment to encourage others to do it. See this feature at work: http://www.litwiki.de FIXME So here comes the snippet directly out of my main.php, which bases on the g21-Media-DokuWiki-template and works with DW-release 2005-09-22: ===== discuss - directly @ main.php =====
*/ // global $ID; // global $ACT; // @todo adjust these strings for localization! Can later be placed in lang.php. $discussNS = 'diskussion'; $btn_discuss = 'Diskussion'; $btn_article = 'Zurück zum Artikel'; // check how $ID is separated if ($conf['useslash'] == '0') { $ns = ':'; } else { $ns = '/'; } // prepare wikilink $wikipath = wl(); // check if we aren't already in discussionNS $idknack = explode($ns, $ID); if (!($idknack[0] == $discussNS)) { // determine the discussion file and link $discussID = $discussNS.$ns.$ID; $discussLINK = "$btn_discuss"; echo $discussLINK; } else { // determine the back-to-article link $articleID = substr($ID,strlen($discussNS)+1); $articleLINK = "$btn_article"; echo $articleLINK; } ?>
====== Comments / Discussion ====== Feel free to gimme your opinion. --- //[[freddyw@gmx.net|Freddy]] 2005-10-23 17:37// ===== Alternative Way ===== I use a similar function in my [[template:ach|ACH Template]] (the central approach is the same). The main difference is that I use more of the internal dokuwiki functions which results eg. in discussion links that show if a discussion page already exists or not (only if links are used and not - like in my template - if buttons are used). Another difference is: I haven't (yet) implemented anything with regard to the ''$conf['useslash']'' option. $discussNS='discussion:'; if(substr($ID,0,strlen($discussNS))==$discussNS) { $backID=substr(strstr($ID,':'),1); /*button: */print html_btn('back',$backID,'',array()); /*link: tpl_pagelink(':'.$backID,$lang['btn_back']);*/ } else { /*button: */print html_btn('discussion',$discussNS.$ID,'',array()); /*link : tpl_pagelink($discussNS.$ID,$lang['btn_discussion']);*/ } The only thing that has to be added in ''./inc/lang/en/lang.php'' and in the other languages respectively is $lang['btn_discussion'] = 'Discussion'; IMHO, the best way to implement a discussion feature to a DokuWiki installation is to put things into ''main.php'', because then it is easier to upgrade. If a discussion feature should be included into the DokuWiki core code, it should be done as you first intended to: with functions in ''inc/template.php'' and so on. --- //[[a.c.henke@arcor.de|Anika Henke]] 2005-12-09 15:49// ---- I've been playing with this alternative method and I have come up with a solution to the buttons not being able to show if the discussion page exists. I do a check for if the file exists, and if it doesn't the button text reads "Start a Discussion." If the discussion page does exist, it says "Discuss this page." I'm also toying around with having the wiki autogenerate the discussion pages with %%======%% Discussion of //pagetitle// %%======%% at the top followed by some comments (using one of the comment plugins) that ask users to scroll to the bottom of the edit window and put their discussion at the bottom of the page. What do you think? I'll post more details when I get back to my computer at home. --- // 2006-01-30 12:57 pm CDT// ---- I was able to get buttons when using the first example by making this change in the last if-block: // check if we aren't already in discussionNS $idknack = explode($ns, $ID); if (!($idknack[0] == $discussNS)) { // determine the discussion file and link $discussID = $discussNS.$ns.$ID; print html_btn('disc',$ID,'',array('id' => "$discussID")) // Replace the two lines with this one } else { // determine the back-to-article link $articleID = substr($ID,strlen($discussNS)+1); print html_btn('article',$ID,'',array('id' => "$articleID")); // Replace the two lines with this one } Then you can add the languages part in **inc/lang/en/lang.php** $lang['btn_disc'] = 'Discussion'; $lang['btn_article'] = 'Return to Article'; I might have gotten something wrong with the $ID part, but it seems to work fine in my wiki. You can see this in action in my wiki at [[http://www.inwetrust.org]]. - Chris Wellons (mosquitopsu -- gmail com) ---- Here is another implementation. I wrote it myself, then improved upon it once I found this page. This one changes the background color when on the talk page and specifies hotkeys. It also processes the $ID carefully, so that multiple namespaces work properly (for example wiki:playground -> talk:wiki:playground). Modifications to **lib/tpl/default/main.php**: Replace **** with (current color is **#bcd**, change as desired): > Find the word **history**, add this as a new line after it: 'show')); } else { $talkID = 'talk' . $sep . $top_ns . $ns . $pn; print html_btn('talk', $talkID, 'c', array('do' => 'show')); } ?> Find the word **history** again, add this as a new line after it: 'show')); } else { print html_btn('talk', $talkID, 'c', array('do' => 'show')); } ?> Modifications to **inc/lang/en/lang.php**: Add these lines: $lang['btn_talk'] = 'Comments'; $lang['btn_article'] = 'Article'; See it at [[http://kidsquid.com/]]. --- //[[dokuwiki@kidsquid.com|Jeffry Johnston]] 2006-02-20 05:55// ---- I like this approach Jeffry. I adapted it to also show a message when someone edits a comments page, i.e. a page in the 'talk' namespace. It adds a notice that the page is for discussing the page itself, rather than the topic, if you see what I mean. Here's what I did: in inc/html.php, find if(!$DATE) $DATE = $INFO['lastmod']; ?> And after it, add: N.B. This page is for discussing the wiki page, not the topic itself.

'; } ?>
--- //[[http://www.pollinger.org.uk|Ben Pollinger]] 2006-06-15//