[Pmwiki-users] Replace text on save?

Patrick R. Michaud pmichaud
Sun Mar 14 20:11:33 CST 2004


On Mon, Mar 15, 2004 at 03:36:15AM +0100, Thomas -Balu- Walter wrote:
> is there a way to replace parts of the text when an author saves the
> page? 

So far I've avoided adding a built-in "modify text on save" feature 
because I think it has the potential for all sorts of nastiness and
abuse.  I like it when the text that is saved is exactly what was
specified.

However, you may be able to get fairly close:

   if (isset(@$_POST['text'])) 
      $_POST['text'] = str_replace('~~~',"{{~$Author}}",$_POST['text']);

Of course, you should be able to make the logic of the replacement
as complex as you wish.

I have no idea what sorts of side effects, if any, something like
this might generate, so YMMV.  Let us know how/if it works.

Pm



More information about the pmwiki-users mailing list