[pmwiki-devel] Link Kludge.
Stirling Westrup
sti at pooq.com
Wed Oct 31 13:35:23 CDT 2007
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.
>> [...]
>
> Better would be to come up with a $HomePage page variable that
> returns the home page for any page in a given group.
>
> If you can describe the process by which we identify a group's
> home page, I can describe how to turn it into a page variable.
> Something like this might even make it into the core, since something
> like $HomePage would seem to be a _lot_ more flexible than the current
> $DefaultName mechanism.
Well, currently, I just look up a PTV in the groups GroupHeader page and use
it if it exists, or I just return the group name as the home name. My function is:
function HomePage($group)
{ global $DefaultGroup;
if( !$group ) $group = $DefaultGroup;
$gh=MakePageName($group,"GroupHeader");
$home = PageTextVar($gh,'HomePage');
if( !$home ) $home = $group;
return $home;
}
The trouble is, I'd rather not have to hunt for all occurrences of [[Group/]]
in my wiki and replace them with [[Group/{Group.$HomePage}]] or something...
More information about the pmwiki-devel
mailing list