[pmwiki-users] Get history/diff in Site.AllRecentChanges ?

Lucian Wischik lu.gmane at wischik.com
Thu Nov 16 01:01:56 CST 2006


Lucian Wischik <lu.gmane <at> wischik.com> writes:
> Put this in local/config.php
> $BaseNamePatterns['/^Comments\.(.*?)-(.*)/'] = '\1/\2';
> $RecentChangesFmt['$SiteGroup.AllRecentChanges'] =
>  '* [[{$BaseName}]]  . . . $CurrentTime $[by] '.
>  '$AuthorLink: [=$ChangeSummary=]';

In the end, I've decided that this is a bad approach.
To recap: I wanted to have publically-editable "comments"
pages included at the bottom of each of my real pages.
The task was to make it so that when the public edits
a comments-page, it takes them back to the primary page.
Also also so that any RSS feeds or Site.AllRecentChanges
entries about the comments will also link directly
to the primary page.

Using $BaseNamePatterns is bad because AllRecentChanges
and RSS feeds both use it, in ways that end up being
different. The following solution worked out better.
Put it in local/config.php

$pagename2 = preg_match('/^Comments[\/\.](.*?)-(.*)$/',$pagename,$matches);
if ($pagename2!=0) $pagename2=$matches[1].'/'.$matches[2];
if ($action=='browse' && $pagename != $pagename2)
{ Redirect($pagename2); exit;
}


Explanation: here, whenever we arrive at a "comments" page
in browse-mode, we redirect immediately to the primary page
that these comments hang off of. This redirection will
happen for instance after users have submitted a change
to the comments page. And it will happen when the user
clicks on a link in the Site.AllRecentChanges page. And
it will happen when the user clicks on a link in their RSS
feed.






More information about the pmwiki-users mailing list