XML/SWF Charts| SlickBoard| Timeline Eons(New)

 < previousnext > 

 

Scripting (PHP, ASP, CFML, Perl, etc.)

 

The download package comes with the sample.xml source file. This is a static XML document prepared manually. However, the source can be either a static XML document, or any script generating the XML code dynamically.

 


PHP

The source file can be sample.php, containing PHP code that generates all the XML code like this:


<?php

print "<chart>";
print "<chart_type>bar</chart_type>";
print "<chart_border top_thickness='0' bottom_thickness='4'>";
print "</chart>";

?>

Or, like this:


<?php

print "

<chart>
<chart_type>bar</chart_type>
<chart_border top_thickness='0' bottom_thickness='4'>
</chart>

";

?>

Or, generating some XML code like this:


<chart>

<?php
print "<chart_type>bar</chart_type>";
?>

<chart_border top_thickness='0' bottom_thickness='4'>
</chart>

Or, generating one or more variables like this:


<chart>
<chart_type><?php print "bar" ?></chart_type>
<chart_border top_thickness='0' bottom_thickness='4'>
</chart>

Notice that XML attribute values must be between single-quotes when they are within a printed string that starts and ends with double-quotes.

 


ASP

The source file can be sample.asp, containing ASP code that generates all the XML code like this:


<%

response.write("<chart>")
response.write("<chart_type>bar</chart_type>")
response.write("<chart_border top_thickness='0' bottom_thickness='4'>")
response.write("</chart>")

%>

Or, like this:


<%

response.write("

<chart>
<chart_type>bar</chart_type>
<chart_border top_thickness='0' bottom_thickness='4'>
</chart>

")

%>

Or, generating some XML code like this:


<chart>

<%
response.write("<chart_type>bar</chart_type>")
%>

<chart_border top_thickness='0' bottom_thickness='4'>
</chart>

Or, generating one or more variables like this:


<chart>
<chart_type><% response.write("bar") %></chart_type>
<chart_border top_thickness='0' bottom_thickness='4'>
</chart>

Notice that XML attribute values must be between single-quotes when they are within a printed string that starts and ends with double-quotes.

 


Central Chart Source

You may create a different XML source for each chart on your web site, or create one central script that generates the data for multiple or all charts. Pass the chart's id to the script, and the script might process the related chart like this:


<?php

//which chart to process
$id =  $_REQUEST['chart_id'];

switch ( $id ){
   case 1:
   $type = "line";
   break;
   
   case 2:
   $type = "column";
   break;
   
   case 3:
   $type = "pie";
   break;
}

?>
							
<chart>
<chart_type><?php print $type ?></chart_type>
</chart>

 

 

 < previousnext > 


Copyright 2003-2014, maani.us