[Pmwiki-users] Page preview mode

Patrick R. Michaud pmichaud
Fri Dec 17 07:45:33 CST 2004

On Sat, Dec 18, 2004 at 02:33:23AM +1300, Robin wrote:
> Hash: SHA1
> Hey there, I'm wondering if there is a way to preview a page via a POST 
> request, similar to what happens when you hit preview on the edit page, only 
> have it look exactly as though it were the real page in place (i.e. without 
> the edit form, and 'unsaved' messages, and so forth).

Sure, just set $PageEditFmt = ''; when you don't want the edit form
to appear.  But ohhhh, I get it, you also don't want the "page preview"
and other stuff to appear.  Just build a version of HandleBrowse
that gets its text from $_POST['text'] instead of from the pagefile.
Something like:

   function HandlePreview($pagename) {
     $text = $_POST['text'];
     $text = '(:groupheader:)'.@$text.'(:groupfooter:)';
     $FmtV['$PageText'] = MarkupToHTML($pagename, $text);
     SDV($HandleBrowseFmt, array(&$PageStartFmt, '$PageText',

   if (@$_POST['preview']) { HandlePreview($pagename); exit(); }

> [...]
> Ideally, I'd have it set so that if you hit the edit link in a capable 
> browser, you get the fancy XUL form, otherwise you get the standard one. It's 
> mainly a project for my own learning, but it would be nice to be able to make 
> it a PmWiki addon if I get far enough with it.

Sounds quite interesting -- let me know how it progresses!


More information about the pmwiki-users mailing list