[pmwiki-users] Discussion link / talk link help
Ian MacGregor
lists at imacgregor.com
Mon Jul 23 23:25:57 CDT 2007
I'm using this from http://www.pmwiki.org/wiki/Cookbook/CommentPageLink
---------------------------------------------------------
Simple Discuss-link solution
Here's a simple alternative solution that creates a "Discuss" link that
toggles to and from a page and the page's corresponding -Talk page.
First we need a {$TalkBaseName} page variable so we can link back to a page
from its -Talk page. These lines in config.php accomplish that:
## Crate a "basename" for "-Talk" pages.
if (preg_match('/-Talk$/', $pagename)) {
$talkbasename = preg_replace("/-Talk\$/", '', $pagename);
$FmtPV['$TalkBaseName'] = "'$talkbasename'";
}
Next, put this markup in Site.PageActions:
(:if match ^.*\-Draft$:)(:else if match ^.*\-Talk$:)
* %item class=browse %[[{*$TalkBaseName} |''Discuss'']]
(:else:)
* %item class=browse %[[{*$FullName}-Talk | Discuss ]]
(:if:)
That's it. Note that a discussion link won't be shown for -Draft@ pages.
Likewise, you can avoid saving drafts of discussion pages by altering the
line that enables drafts.
if (! preg_match('/-Talk$/', $pagename)) $EnableDrafts = 1;
This solution works if you're using the PmWiki skin or any other skin that is
compatible with the default Site.PageActions. With a little modification it
will work in a sidebar.
---------------------------------------------------------
This works great, thanks to Hagan for writing it up. My question is how can I
get all $group.$name-Talk pages to go into a dedicated group (let's say
the "Comments" group or "Talk" group) instead of the same group the original
page is in?
Regards,
Ian MacGregor
--
http://www.imacgregor.com
MacGregor Despite Them!
More information about the pmwiki-users
mailing list