[pmwiki-users] Automated WikiTrails.

Stirling Westrup sti at pooq.com
Tue Aug 29 18:43:21 CDT 2006


Martin Fick wrote:
> --- Stirling Westrup <sti at pooq.com> wrote:
> 
>>> --- Stirling Westrup <sti at pooq.com> wrote:
>> In the end I did get it all to work though. I added
>> the following lines
>> to my local/config.php:
>>
>>  global $FmtPV,$pagename,$BaseName;
>>
>>  #define a new list=chapters pagelist option.
>>  $SearchPatterns['chapters'][] = '/-\\d+$/';
>>
>>  #Create a new {$BaseName} Page Variable which is
>> the same as {$Name}
>>  #but with any trailing '-' part of the name
>> removed.
>>  $BaseName =
>>
> preg_replace("/-[^-]*$/","",PageVar($pagename,'$Name'));
>>  $FmtPV['$BaseName'] = '$GLOBALS["BaseName"]';
>>
>> Then I created a Stories.GroupHeader containing:
>>
>>  (:pagelist name={$BaseName}-* list=chapters
>> fmt=#trailstory:)
> 
> That was going to be my next suggestion. :) I think
> that is a fairly elegant solution for this special
> purpose problem.  One way to potentially make it
> slightly more generic would be to use the
> PageVariablesExtensions recipe with a custom function
> which can remove the trailing part of the name.
> 
That's one of the first things I tried. Alas, PageVariableExtensions
don't play nicely with pagelists or it would have made the job much easier.




More information about the pmwiki-users mailing list