XML_FOAF_Parser Example
Please enter a FOAF file below";
} else {
$foaf = file_get_contents($_REQUEST['foaf']);
// Require the XML_FOAF_Parser class
require_once 'XML/FOAF/Parser.php';
// Create new Parser object
$parser = new XML_FOAF_Parser;
// Start of output
echo 'XML_FOAF_Parser Example
';
if (isset($_REQUEST['xml'])) {
echo '' .htmlentities($foaf). '
';
}
// Parser our FOAF in $foaf
$parser->parseFromMem($foaf);
if (isset($_REQUEST['table'])) {
// Show our FOAF as an HTML table
echo "FOAF as HTML Table
";
echo $parser->toHTML($parser->toArray());
}
if (isset($_REQUEST['array'])) {
// Show the contents of the FOAF Data array
echo "FOAF as Array
";
echo "";
var_dump($parser->toArray());
echo "
";
}
}
?>
!How will the plugin(s) work?
# FoafViewerPlugin is embedded in a normal phpwiki page, with default arguments coming from $_GET varibles.
# FoafMakePlugin will get some kind of user id from the database, and retrieve any stored information about the user - outputting as FOAF.
!Installing PEAR / XML_FOAF
The XML_FOAF PEAR library will not be included with phpwiki, so you have to install the PEAR
library by your own and be sure that the PEAR path is in the include_path.
Reason: XML_FOAF is based on XML_Parser and XML_Tree, but phpwiki uses its own XML parser and XML
tree representation, so it would be unneccesary and incompatible duplication of the same thing.
See: http://pear.php.net/package/XML_FOAF
PHP Version: PHP 4.3.0 or newer
PEAR Package: XML_Tree 1.1 or newer
PEAR Package: XML_Beautifier 0.2.2 or newer
PEAR is dead simple to install.
!! Win32