Simple Discuss Link

Summary: Add an action (or sidebar) link that leads to and from a -Talk page.
Version: 2007-07-25
Prerequisites: PmWiki 2.1.27 or newer
Status: Initial Release
Maintainer: Hagan Fox

Description

 is to first create a {$BaseName} page variable with the following in config.php :
## Create a {$BaseName} page variable for "-Talk" pages.
if (preg_match('/-Talk$/', $pagename)) { $BaseNamePatterns['/-Talk$/'] = ''; }

Next, put this markup in Site.PageActions:

(:if name *-Draft :)(:else if name *-Talk :)
* %item              class=browse    %[[{*$BaseName} |''Discuss'']]
(:else:)
* %item              class=browse    %[[{*$FullName}-Talk | Discuss ]]
(:if:)

That's it. Obviously you can modify the links to suit your taste.

A discussion link won't be shown for -Draft pages. You can similarly avoid saving drafts of discussion pages by altering the line that enables drafts.

if (! preg_match('/-Talk$/', $pagename)) $EnableDrafts = 1;

CMS enhancements

If you set a sitewide default read password you may not want non-authors to "see" your -Talk pages.

If you have $EnablePageListProtect set to 1 you can set a read password of @_site_edit on your -Talk pages.

TODO: Add note about edit templates here.

In addition, you can largely ensure your -Talk pages are inaccessible with

if (! CondAuth($pagename, 'edit')) {
  $SearchPatterns['default'][] = '!-Talk$!';
  if (preg_match('/-Talk$/', $pagename)) {
    $basename = preg_replace("/-.*\$/", '', $pagename);
    Redirect($basename); }
}

Notes

This solution works if you're using the PmWiki skin or any other skin that is compatible with the default Site.PageActions. It will work in a sidebar, but not as seamlessly (additional development required to suppress ? on non-existent pages).

This recipe only creates a link to and from a -Talk page. It's not a solution similar to that seen on Wikipedia (with a form for adding a new comment).

Comments

See Also

Contributors

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