[Pmwiki-users] Feature request?

Christian Ridderström chr
Wed Dec 3 15:51:27 CST 2003


On Wed, 3 Dec 2003, Patrick R. Michaud wrote:

> I'm not sure, but I think the code for automatically creating links
> should perhaps go in the Cookbook on the pmichaud.com site instead of
> the Development group.  In general the Cookbook is the place for
> working code samples, scripts, and configuration items, while the
> Development group is used for discussion and design of new features.

I still consider it under development... since I've never programmed PHP 
before, _and_ I've made some changes to it, I think someone else should 
have a look at it before it goes into the cookbook.

A general question btw, I guess it should go into the cookbook first, 
regardless if it'll eventually end up in the regular PmWiki code base?

/Christian

PS. What's this address that keeps popping up? Should I delete it, or can 
I just ignore it?
          Pmwiki-users-bounces at pmichaud.com



/Christian

> 
> On Monday, December 1, 2003, 11:58:18 AM, you wrote:
> 
> > Taking my own suggestion in another mail I recently sent, I put the code
> > for automatically creating links to groups on this page:
> 
> > 	http://www.pmichaud.com/wiki/Development/AutoCreateGroupLinks
> 
> > The comments of the code, and it's problems are also on the page.
> 
> > /Christian
> 
> > On Sun, 30 Nov 2003, Christian Ridderstr?m wrote:
> 
> >> On 24 Nov 2003, John Rankin wrote:
> >> 
> >> > 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;
> >> > 
> >> > and
> >> > 
> >> >   $ref = "$t/\{\{$tref}}";
> >> 
> >> Ok... something like this? (What is local/group.php, I don't have it...).
> >> I've also added a hack so that this works with selfreference.php
> >> 
> >>   //
> >>   //      Automatic creation of 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).
> >>   //
> >> + // Caveat: If $DefaultTitle is different for different groups, this code
> >> + // might not work properly.
> >>   //
> >> - $FmtWikiLink = 'MyFmtWikiLink';
> >> + $oldFmtFcn_AutoCreateGroupLink = $FmtWikiLink;
> >> + $FmtWikiLink = 'AutoCreateGroupLink';
> >> - function MyFmtWikiLink($pat,$ref,$btext,$out=NULL,$pname=NULL) {
> >> + function
> >> AutoCreateGroupLink($pat,$ref,$btext,$out=NULL,$pname=NULL) {
> >> -   global $DefaultTitle;
> >> +   global $DefaultTitle, $SpaceWikiWords, $oldFmtFcn_AutoCreateGroupLink;
> >>     $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
> >> +       $tref = ($SpaceWikiWords) ? AsSpaced($t) : $t;
> >> +       $ref = "$t/\{\{$tref}}";
> >>       } elseif (PageExists("$t.$DefaultTitle"))  // try HomePage
> >> -       $ref = "$t.$DefaultTitle";
> >> +       $ref = "$t.\{\{$DefaultTitle}}";
> >>     }
> >> -   return FmtWikiLink($pat,$ref,$btext,$out,$pname);
> >> +   return
> >> $oldFmtFcn_AutoCreateGroupLink($pat,$ref,$btext,$out,$pname);
> >>   }
> >> 
> >> /Christian
> >> 
> >> 
> 
> 
> 
> 
> 

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




More information about the pmwiki-users mailing list