[pmwiki-users] How to view a page and its links as at a specified date and time

Patrick R. Michaud pmichaud at pobox.com
Sun Oct 16 21:00:31 CDT 2005


On Mon, Oct 17, 2005 at 02:04:23PM +1300, John Rankin wrote:
> On Sunday, 16 October 2005 12:04 PM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> >On Fri, Oct 14, 2005 at 02:47:43PM +1300, John Rankin wrote:
> >> Any hints on how to extract the wiki text as at 
> >> a point in time, so it can be displayed? 
> >
> >Do you need the full page as it existed then (i.e., no history
> >since $datetime), or just the page text at that point?
> 
> Just the page text. 

One can use the RestorePage function for this.  For example, to
get the text of a page as it existed as of October 1, 2006:

    $when = mktime(0, 0, 0, 10, 1, 2006);
    $page = ReadPage($pagename, $when);
    $new = array();
    $text = RestorePage($pagename, $page, $new, "diff:$when");

($new is a dummy array here; normally RestorePage is used to fill
in the text of $new when the Restore link is activated.)

In reviewing the code I also found that RestorePage doesn't work
exactly as it should, so there will be an update soon that fixes
it.  :-)

> I envisage 'Previous' and 'Next' links
> that show the previous and next versions of the page,
> letting a reader see how a page has evolved. In an ideal
> world: pick any 2 versions and generate a page with the 
> differences between them highlighted.

This sounds like it'd be a good upgrade for ?action=diff;
over the years there's been a handful of requests for an alternate
?action=diff display like this; so far I've held off waiting
for the number of requests to be more than a handful (and 
for a more complete description of what we'd like to see
here :-).

Pm




More information about the pmwiki-users mailing list