Patrick R. Michaud wrote: > On Wed, Oct 31, 2007 at 02:35:23PM -0400, Stirling Westrup wrote: >> Patrick R. Michaud wrote: >>> On Wed, Oct 31, 2007 at 01:42:55PM -0400, Stirling Westrup wrote: >>>> I have a problem, and there doesn't seem to be a simple way of solving it. >>>> The >>>> markup [[Group/]] creates a link to the home page of Group. This is done >>>> via >>>> the definition of $DefaultName. What I need, is a way to associate >>>> different >>>> home pages with different groups. Its trivial to write up a function that >>>> looks up the home page for a particular group, but the context in which >>>> $DefaultName is expanded doesn't seem to include the information of which >>>> group the home page is for.
> Yes, but you could easily set $PagePathFmt to be > > $PagePathFmt = array('{$Group}.$1', '$1.{$HomePage}'); > > and then MakePageName will use the $HomePage page variable instead > of $DefaultPage when computing the result of "Group/" or "Group." > So would other places that want to treat a page reference as a > link to a group's home page. > > Also, I think the above function is better written as: > > function HomePage($pagename) { > $group = PageVar($pagename, '$Group'); > $home = PageTextVar("$group.GroupHeader", 'HomePage'); > if (!$home) $home = $group; > return $home; > } > I agree. Mine was just something I threw together while testing the idea. > Then it can be turned into a page variable with > > $FmtPV['$HomePage'] = 'HomePage($pn)'; > > This, combined with setting $PagePathFmt as given above, should > give you what you want. Alas, it doesn't. Something like this was the first thing I tried, actually. The problem is that a link like [[Group/]] in Site.Sidebar results in $HomePage being expanded to HomePage("Site.Sidebar"), the Group we are trying to look up is lost. _______________________________________________ pmwiki-devel mailing list pmwiki-devel@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-devel