|
Cookbook /
Simple Discuss LinkSummary: 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
DescriptionA simple solution that creates a "Discuss" link that toggles to and from a page and its corresponding -Talk page is to first create a
## 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
if (! preg_match('/-Talk$/', $pagename)) $EnableDrafts = 1;
CMS enhancementsIf you set a sitewide default read password you may not want non-authors to "see" your -Talk pages. If you have 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); }
}
NotesThis 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). CommentsSee Also
ContributorsUser 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. |