[pmwiki-users] display older page versions
Peter Bowers
pbowers at pobox.com
Wed Mar 11 15:30:22 CDT 2009
On Wed, Mar 11, 2009 at 4:13 PM, Peter Bowers <pbowers at pobox.com> wrote:
On Wed, Mar 11, 2009 at 10:29 AM, noskule <noskule at gmx.net> wrote:
>
> Actually this is possible using wikish. See
>>
>> http://www.pmwiki.org/wiki/Cookbook/WikiShExamples#PageHistForm
>>
>> This solution gives you a form to type in a pagename and a date
>> description
>> ("1 hour ago", "yesterday", "1/1/09 1:00am", "last Thursday", etc.) and
>> the
>> page will be displayed immediately below the form between horizontal
>> lines.
>>
>> -Peter
>>
>>
>>
>>
> this looks very promissing to me (except I have to switch to php5 first).
> But one question.
> Would it be possible to have an action called something like
> action=showdiff×tamp=unixtime, witch would
> display/highlight the changes directly in the rendered page?
>
After a little messing around with pear (1st time I've used it to install
something) I ended up with this in my config.php which does in fact give me
a prettily highlighted diff. (Note that I had to specify $action ==
'browse' as well because it was messing up the page history otherwise.)
if ($pagename == 'Test.Diff' && $action=='browse') {
$DiffFunction = 'mydiff';
include_once("Text/Diff.php");
include_once("Text/Diff/Renderer.php");
include_once("Text/Diff/Renderer/inline.php");
function mydiff($text1, $text2)
{
$diff = &new Text_Diff(explode("\n", $text1), explode("\n",
$text2));
$renderer = &new Text_Diff_Renderer_inline();
return($renderer->render($diff));
}
}
I went ahead and coded up the diff form too (it's virtually identical to the
previous solution except using the diff command.) You can see it here:
http://www.pmwiki.org/wiki/Cookbook/WikiShExamples#HistDiffForm
This form allows you to enter the page name and some date string. After you
submit you will be shown the diff output comparing that revision with the
current revision, even if there are several revisions in between. If you
combine this with the PEAR Text_Diff mentioned above then you've got a very
useful little tool that's very user-friendly...
-Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20090311/1973fa2d/attachment.html
More information about the pmwiki-users
mailing list