|
Re: Page preview can now be implemented rather easy: msg#00085web.wiki.pmwiki.user
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> |
|---|---|---|
| Previous by Date: | RE: Table styles: 00085, Edward Andrews |
|---|---|
| Next by Date: | Re: Page preview can now be implemented rather easy: 00085, Patrick R. Michaud |
| Previous by Thread: | Page preview can now be implemented rather easyi: 00085, Bernhard.Weichel@xxxxxxxxxxx |
| Next by Thread: | Re: Page preview can now be implemented rather easy: 00085, Patrick R. Michaud |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |