Class Chart - XML Generator for DHTMLX
$chart = new Chart( set encoding, default utf-8 )
$chart = new Grid;
or
$chart = new Chart('iso-8859-1');
$chart->item( array( 'key attribute' => 'value attribute' ) )
$chart->item(
array(
"id" => 01,
"sales" => "35",
"year" => "'07"
)
);
$chart->header()
$chart->header();
return
header("Content-type: application/xml; charset=utf-8");
$chart->result()
echo $chart->result();
Print XML
<?php
include_once 'DHX.php';
$chart = new Chart;
$chart->item(
array(
"id" => 01,
"sales" => "35",
"year" => "'07"
),
array(
"id" => 11,
"sales" => "50",
"year" => "'08"
),
array(
"id" => 21,
"sales" => "65",
"year" => "'09"
),
array(
"id" => 31,
"sales" => "30",
"year" => "'10"
),
array(
"id" => 41,
"sales" => "45",
"year" => "'11"
)
);
$chart->header();
echo $chart->result();
?>
Result
<?xml version="1.0" encoding="utf-8"?>
<data>
<item id="1">
<sales>35</sales>
<year>'07</year>
</item>
<item id="11">
<sales>50</sales>
<year>'08</year>
</item>
<item id="21">
<sales>65</sales>
<year>'09</year>
</item>
<item id="31">
<sales>30</sales>
<year>'10</year>
</item>
<item id="41">
<sales>45</sales>
<year>'11</year>
</item>
</data>
Lucas Tiago de Moraes