PreviewFirst

(redirected from Cookbook.PreviewTop)

Summary: How to get the page preview to appear before the edit box
Version: 2.0 beta 44 and later
Prerequisites:
Status:
Maintainer: Petko

Question

How can I get the page preview to appear before the edit box?

Answer

PmWiki 2.0 beta 44 and later

To adjust the position of the page preview, edit the Site.EditForm special page on your wiki.

PmWiki versions 2.0.beta43 and earlier

This recipe can be only useful for sites running PmWiki version 2.0.beta43 and earlier.

The following was copied from the very similar PreviewTop page (now redirected here):

This recipe is superceded by 2.0.beta44. Now to adjust the position of the page preview, edit the Site.EditForm page on your site. --Pm

What that comment does not mention is that if you continue to use the old syntax that follows below, you will get the old edit form. -Jefferson (14 August 2005)||

Add the following line to a local customization:

$HandleEditFmt = array(&$PageStartFmt,&$PagePreviewFmt, &$PageEditFmt,&$PageEndFmt);

Discussion

This simply changes $HandleEditFmt to reverse the order of the page preview output (in $PagePreviewFmt) and the edit box in ($PageEditFmt). This page has this customization enabled, so that previews appear above the edit box.


22-Nov.2018 The above didn't work for me, this is what I did:
The follow will show a preview every time at the top
In file Site.EditForm
in between "the edit page layout form " and " Editing { FullName"
%0a 4 dashes %0a Page is unsaved %0a 4 dashes,
This is at the bottom of that page, use that formatting

In pmwiki.php, about line 2100
Instead of line: SDV($HandleEditFmt, array(&$PageStartFmt, &$PageEditFmt, &$PageEndFmt));
I have: SDV($HandleEditFmt, array(&$PageStartFmt,MarkupToHTML($pagename, $new['=preview']),"<BR>", &$PageEditFmt,&$PageEndFmt) );
This is a hack! YMMV

It is strongly recommended NOT to edit pmwiki.php or other core scripts (everything is configurable, really, everything), and the files in wiki.d and wikilib.d are page data files intended to be edited via the wiki interface. For example, you could open your wiki in your browser and edit your own page Site.EditForm, placing the block (:if e_preview:)...(:ifend:) at the top of the page and save the page. To always show a preview when editing a page, even when the person has not pressed the "Preview" button, add this in config.php: if($action == "edit") $_REQUEST['preview'] = 1;. Here you should not need to set a custom $HandleEditFmt, but if you must modify any core variable, just define it in config.php and PmWiki will use your value instead of the default one. --Petko November 22, 2018, at 03:10 PM


Contributors

  • Pm, 21-Jun-2004

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.