[pmwiki-users] Discuss/talk link help

Ian MacGregor lists at imacgregor.com
Wed Jul 25 15:32:02 CDT 2007


I'm going to go with Hagan on this as he made some good points and it works 
fine as is:

----------------------------------------------
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. You 
can similarly 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 fine and I am thinking that putting the above if statement for 
Site.PageActions in GroupFooter will work great. However, I need to set an 
array of pages/actions in which the "Discuss" links will not appear, pages 
like $group.(All|Recent)Changes, ?action=refcount. How do I do that?

Regards,
Ian MacGregor
-- 
http://www.imacgregor.com
MacGregor Despite Them!



More information about the pmwiki-users mailing list