Please consider the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PieChart</title>
</head>
<body>
<div align="center">
<cfchart
format="png"
scalefrom="0"
scaleto="1200000"
pieslicestyle="solid">
<cfchartseries
type="pie"
serieslabel="Website Traffic 2006"
seriescolor="blue">
<cfchartdata item="% OPEN" value="30">
<cfchartdata item="%DROPPED" value="1">
<cfchartdata item="% PROCESSED" value="20">
<cfchartdata item="% BOUNCE" value="1">
<cfchartdata item="% DELIVERED" value="17">
<cfchartdata item="% DEFERRED" value="31">
</cfchartseries>
</cfchart>
</div>
</body>
</html>
The above file name is "PieChart.cfm"
In the above code, I have hard coded the values (30,1,20,1,17,31). However, I have other coldfusion files with me for example (Count_Open.cfm
which has SQL statement inside it and the file is returning the value of % OPEN
, similar is the case with other files as well, namely, Count_Dropped.cfm
,Count_Delivered.cfm
rtc )
How can I use the values returned by above files in my file PieChart.cfm
so that if the data keeps on changing, I don't have to run the files again and again and hard code the values.
Please help and let me know if my questions is not clear.
Thanks
The cfinclude tag might be the way to go. I would include this one in the other ones. Pay attention that you are not duplicating doctype, html, head, or body tags.