logo       

Re: Page preview can now be implemented rather easy: msg#00085

web.wiki.pmwiki.user

Subject: Re: Page preview can now be implemented rather easy

Bernhard, that is very useful.

Using your idea, I created a short script that does the same thing for a
standard PmWiki install -- an adminitrator just includes preview.php (available
on request). It introduces a preview action and a HandlePreview function.

Where I have got stuck is dealing with [[...]] directives, such as [[include:
or [[nogroupheader]] in the preview.

Both the PrintText function and $PageEditFmt by default use $Text, so if I
change $Text to deal with [[...]] stuff, it will also change the form contents,
which I clearly don't want. I assume there is a way I can tell the array that
defines the preview screen display to pass a $PreText parameter to PrintText,
as you have done, and use $Text in the form, but I haven't tried it yet.

Incidentally, based on seeing how the HandlePost function works, you may need
to write:
$newtext=str_replace("\r","",stripslashes($HTTP_POST_VARS["text"]));
This might be why your InlineReplacements aren't working.

I also have a minor, but annoying, problem of leading and trailing 'return'
characters being stripped off. So my GroupFooter which starts with ---- keeps
getting turned into 2 em dashes (SmartQuotes finds inline --, because the ----
is no longer at the start of a line and doesn't get turned into a <hr />).
--
John Rankin

On Monday, 16 June 2003 7:28 AM, Bernhard.Weichel@xxxxxxxxxxx wrote:

Hello Patrick,

due to the new features in 0.5.x (in particular PrintText) it is now
possible to implement the highly desired page preview feature. Here is the
code, I am using.

else if ($myaction=="edit" | $myaction=="preview")
{
global $HTTP_POST_VARS, $Text;
$newtext=$HTTP_POST_VARS["text"]; // don't know how the text should be
processed
// it seems that fixing inlines must
be done here
if ($newtext=="") {$newtext=$Text;} // if preview was called directly,
not via edit

if ($myaction=="preview") {PrintText($pagename, $newtext);}

...






<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise