PHP Macro
This is a XWiki macro, which isn't bundled with any XWiki product by default.
Macro developed by the XWiki Development Team.
This macro can be downloaded.
Macro developed by the XWiki Development Team.
This macro can be downloaded.
PHP Macro
This macro executes embedded PHP scripts. Usage:{{php}}<?php echo 'Hello World!'; ?>{{/php}}Hello World!
Installation
To use the php macro, you need to install the following three libraries inside WEB-INF/lib directory of your XE installation:- XWiki PHP Macro (select a version compatible with your wiki)
- Quercus library (select the latest version)
- Resin utils (select the same version as the quercus library)
INFO: Failed loading com.caucho.quercus.lib.dom.DOMText java.lang.ClassNotFoundException: com.caucho.quercus.lib.dom.DOMText
Usage
Unlike the other scripting languages available for XWiki, PHP is a semi-templating scripting language, which means that it must explicitly wrap code sections inside <?php ?> markers:Some *wiki* content.
{{php}} Some static content inside the PHP macro,
<?php echo("and some dynamic content."); ?> {{/php}}{{php}} <?php $i = 5; ?>
$i will be visible inside the same macro block:
<?php echo ($i); ?>
The correct value of i will be printed, 5.
{{/php}}
Unfortunately, here $i will not be valid:
{{php}} <?php echo ($i); ?> {{/php}}