[pmwiki-users] Prepend text string to wiki file when saving - a possible solution

Josh Miller josh at virtualmillers.net
Tue Sep 11 10:53:12 CDT 2007


Hello!

If anyone is curious, I found the resolution to my problem in a cookbook
recipe.

Instead of prepending the text when I save, it just prepends text when
an (:include:) statement is found.

In case anyone else is trying to add an "edit" link to included pages to
edit the original included page, this cookbook recipe works great!

I added the below to my config file:

###Cookbook Recipe: IncludeWithEdit
###see http://www.pmwiki.org/wiki/Cookbook/IncludeWithEdit
	Markup('included','>if',"/\\(:include\\s+(.+?):\\)/e",
         "PRR().'<p class=\\\'included\\\'><span class=\\\'button\\\'>".
         "(:if !loggedin
:)[[$1?action=edit|Attach:Site/editwikipage.gif]](:ifend:)</span></p>'".
         ".IncludeText(\$pagename,'include $1').".
         "'<br/><p class=\\\'included\\\'/>'");

I use UserAuth, hence the (:if !loggedin :) - you can take that line out
if you don't use UserAuth.
There are also some css styles on that cookbook page that are handy.

Good Luck!

-Josh Miller
Gouverneur





More information about the pmwiki-users mailing list