//output XOXO if (count($classes) < 1) { $classes = array('xoxo'); } //If we were not passed classes, output has default class of 'xoxo' header('Content-Type: application/xml;charset=utf-8'); //sent the XML http header (should be HTML or XHTML, but is XML so Ning stuff doesn't get output and mess it up) echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' . "\n"; //Output XHTML 1.1 doctype so that etc is legal $struct->toXOXOFields(); //convert fields to standard XOXO field names if ($_REQUEST['simplify']) { $struct->simplify(); } //if we're simplifying, do so echo $struct->toXOXO($classes); //output XOXO markup for the object (with given classes) exit; //we're done } //end if output == xoxo if ($_REQUEST['output'] == 'json') { //output JSON if (count($classes) < 1) { $classes = array('nodes'); } //Classes are used as the field name for subnodes. If no classes were passed, use 'nodes' header('Content-Type: text/javascript;charset=utf-8'); //output JavaScript http header if ($_REQUEST['simplify']) { $struct->simplify();