[Pmwiki-users] changing background color for pages edit/preview pages

Patrick R. Michaud pmichaud
Wed Dec 8 20:44:06 CST 2004

On Tue, Dec 07, 2004 at 03:27:28PM -0600, Matt Vance wrote:
> I've made the mistake a couple of times of forgetting that I'm 
> editing/previewing a pmwiki page, rather than simply viewing it.  Is 
> there any easy way to change the background color or otherwise 
> distinguish that the page is a preview and hasn't yet been saved?

In config.php:

   if (@$_POST['preview']) 
     $HTMLStylesFmt[] = ' body { background-color:#ffeeee; } ';

causes any previewed edit to have a light-pink background color. 
You can also use a background image if you wish:

   if (@$_POST['preview'])
     $HTMLStylesFmt[] = 
       ' body { background-image: url($PubDirUrl/preview-150.gif); } ';

I've set up an example at 
http://www.pmwiki.org/wiki/Test/PreviewChange?action=edit -- click on the
"Preview" button and you should see the background change to indicate that
you're previewing the page and it hasn't been saved yet.

Yet another item that belongs in the Cookbook.  :-)


More information about the pmwiki-users mailing list