[Pmwiki-users] Links in template pages

Patrick R. Michaud pmichaud
Tue Sep 7 07:30:57 CDT 2004

On Tue, Sep 07, 2004 at 03:11:44PM +0200, Thomas -Balu- Walter wrote:
> > How about putting the following in your template (in place of the
> > <!--function:...--> you wrote above):
> > 
> >    <a href='$PageUrl-Discussion'>Discuss</a>
> Wouldn't this allow the creation of
> WikiPage-Discussion-Discussion-Discussion-...?

Oh.  Yeah, it would.  Okay, how about this:

function DiscussLink($pagename,$args) {
  # if the current page already ends in "-Discussion", don't make a link
  if (preg_match("/-Discussion$/",$pagename)) return '';

  # otherwise, generate a link using FmtWikiLink
  return FmtWikiLink('',"{{$pagename-Discussion}}","Discuss");

Then include <!--function:DiscussLink--> in the template.

I'm likely to add a <!--markup:--> directive, which would process the 
argument text as though it were wiki markup.  If this existed, I think 
one could do 

    <!--markup:[[{{[[$Title]]-Discussion}} Discuss]]-->

and get much the same effect (but no, it doesn't exist yet).


More information about the pmwiki-users mailing list