Sign in to follow this  
ac

&dataURL=headcount.xml works why not &dataURL=headcount.php?

Recommended Posts

Why can't I do this:

.... <chart stuff>

&dataURL=headcount.php

Where, headcount.php is simply a bunch of php statements that return xml data:

<?php

echo "<chart caption='Monthly Headcount' >";

echo "<set label='20070701' value='117'/>";

echo "<set label='20070801' value='123'/>";

echo "<set label='20070901' value='122'/>";

echo "</chart>";

?>

 

If I put this xml data into a file called 'headcount.xml' and change chart to use &dataURL=headcount.xml it works just fine. But I want the xml data to be generated dynamically.  Am I missing something here? I need a clue.

Share this post


Link to post
Share on other sites

Stumbled upon the answer myself....

First, you want to inlcude header('Content-type: text/xml'); so you can directly view the xml data in a browser.  This showed me I was missing the top level element.  So I changed headcount.php to this and it works:

<?php

echo "<chart caption='Monthly Headcount'>";

echo "<set label='20070101' value='97'/>";

echo "<set label='20070201' value='96'/>";

echo "<set label='20070301' value='103'/>";

echo "<set label='20070401' value='108'/>";

echo "<set label='20070501' value='110'/>";

echo "<set label='20070601' value='115'/>";

echo "<set label='20070701' value='117'/>";

echo "<set label='20070801' value='123'/>";

echo "<set label='20070901' value='122'/>";

echo "</chart>";

?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this