[pmwiki-users] Re: PHP code in pages
Christian Schlatter
ch at schlatter.net
Thu Jun 30 08:00:33 CDT 2005
Anno wrote:
> Nobody has an idea how this could be done?
Well, I'd have a look at PHP's eval function
(http://php.benscom.com/manual/en/function.eval.php).
Then you could write your own markup rule that feeds its input into the
eval function.
Outlined solution:
Markup('php', 'fulltext',
'/\\(:php:\\)[^\\S\n]*\n(.*?)\\(:php\\s?end:\\)/seim',
"phpeval(PSS('$1'))");
function phpeval($str) {
ob_start();
eval($str);
$eval_buffer = ob_get_contents();
ob_end_clean();
return $eval_buffer; // maybe also return Keep($eval_buffer)
}
Though I haven't tested that ;-)
-ChristianS
More information about the pmwiki-users
mailing list