[Pmwiki-users] Extending/Replacing PrintText

Greg Morgan Cybie
Mon Mar 1 12:52:25 CST 2004


I was wondering if in a future version of PmWiki the PrintText funtion could
be handled in a manner similar manner to HandleEdit, etc.
#add this to PmWiki
$PrintText = 'HandlePrintText';
 
function HandlePrintText($pagename,$text="") {
#All of the code that is currently in PrintText should go here
}
 
function PrintText($pagename,$text="") {
global $PrintText,$Text;
  if ($text=="") $text=$Text; 
$handle = @$PrintText;
if (function_exists($handle)) $handle($pagename,$text);
else { HandlePrintText($pagename,$text); }
}
 
-------------
This way cookbook authors can write code like this.
$OldPrintText=$PrintText;
$PrintText = 'MyPrintTextFunc';
 
function MyPrintTextFunc ($pagename,$text="") {
global $OldPrintText,$Text;
if ($text=="") $text=$Text; 
#Do whatever processing I need here.. use the keep function to preserve the
html I generate.
 
 
#Call the standard print text function
$handle = @$OldPrintText;
if (function_exists($handle)) $handle($pagename,$text);
else { HandlePrintText($pagename,$text); }

}
--
 
I hope that's somewhat clear... I haven't finished my coffee yet. :)
BTW, now that I'm thinking about it, it would be useful to have ReadPage and
WritePage handled the same way.  Eventually I can see the Powers That Be at
my work wanting to move the Wiki to a SQL database.
Let me know what you think.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://contra.vosn.net/pipermail/pmwiki-users_pmichaud.com/attachments/20040301/a344106f/attachment.htm


More information about the pmwiki-users mailing list