[Pmwiki-users] Feature request?

John Rankin john.rankin
Sun Nov 23 13:04:12 CST 2003

Good morning...

For consistency it should also do $ref = "$t.\{\{$DefaultTitle}}";

And there will be a problem, I think, if there are entries
in local/group.php that redefine $DefaultTitle -- you end up 
trying to find whatever the current group has $DefaultTitle set
to, which may not be the same as that set for the $t group.

If one wants to be *really* pedantic, perhaps also:

  global $SpaceWikiWords;

  $tref = ($SpaceWikiWords) ? AsSpaced($t) : $t;


  $ref = "$t/\{\{$tref}}";


John Rankin

On Sunday, 23 November 2003 8:36 AM, Christian Ridderstr?m <chr at home.se> wrote:

Thank's for this tip!

I think it should become a standard part of pmwiki, possibly disabled per 
default. Below I've pasted the function including Jason's latest 
suggestion, and a comment. Hope the comment is accurate...

//	Automatic group links
// The hook below changes a wiki-link pointing to a non-existing page, 
// so that it points to the homepage of a group with the same name as the 
// link (if that group and it's homepage exists).
$FmtWikiLink = 'MyFmtWikiLink';
function MyFmtWikiLink($pat,$ref,$btext,$out=NULL,$pname=NULL) {
  global $DefaultTitle;
  $pg = FmtWikiLink($pat,$ref,$btext,'PageName',$pname);
  if (!PageExists($pg))
      $t = preg_replace("/^.*\\./",'',$pg);
      if (PageExists("$t.$t"))
        $ref = "$t/\{\{$t}}";    // in case $t isn't a wikiword
      elseif (PageExists("$t.$DefaultTitle"))  // try HomePage
        $ref = "$t.$DefaultTitle";
  return FmtWikiLink($pat,$ref,$btext,$out,$pname);


On Thu, 20 Nov 2003, J. Perkins wrote:

> John,
> Getting closer! On my system, the string "{{$t}}" printed the value of 
> $t between curly quotes, ie. "{WikiWord}", so I changed that line to
>     $ref = "$t/\{\{$t}}";  // in case $t isn't a wikiword
> ...which seemed to do the trick.
> Jason

Dr. Christian Ridderstr?m, +46-8-768 39 44       http://www.md.kth.se/~chr

Pmwiki-users mailing list
Pmwiki-users at pmichaud.com

More information about the pmwiki-users mailing list