[pmwiki-users] Automated WikiTrails.

Stirling Westrup sti at pooq.com
Tue Aug 29 14:25:53 CDT 2006

Martin Fick wrote:
> --- Stirling Westrup <sti at pooq.com> wrote:
>> The plan is to put the (:pagelist:) command into
>> Stories.GroupHeader and
>> I don't see how that's possible using HttpVariables.
>> What am I missing?
> Yes, you would put this pagelist in the
> Stories.GroupHeader:
> (:pagelist list=chapters name={$?Story}*
>   fmt=#storytrail:)
> The parts I didn't mention is that you need to both
> (1) pass on the Story URL argument from page to page
> using the prev and next chapter links and you need to
> (2) seed your trail wherever a user might start
> following it.


> If this all sounds too complicated, you should
> consider splitting yor stories into separate groups,
> it would be much easier, then you can just use the
> Group name as the filter and it will be inherently
> known by each page.

This did work out as being much too complicated, and I didn't want to
use multiple groups because the Stories group has different user
authorizations than my other groups, and I'd have to go through setting
all that up again for each new Story group.

I also didn't like the idea of tacking things onto my URLs to carry the
trailness of the process, as it were.

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:)

And put this into my Site.LocalTemplates:

 (:if equal {$FullName} {=$FullName}:)
 %wikitrail%[[{<$FullName}|<< {{<$FullName}$Title}]] | [[{$BaseName}]] |
 [[{>$FullName}|{{>$FullName}$Title} >>]]

The results need a few aesthetic tweaks, but its all completely
functional now and I don't expect any further difficulties.

I do want to thank everyone who helped me out with this though. I had
tried all sorts of things before and had never gotten close to making it
all work.

More information about the pmwiki-users mailing list