0
Using cfcontent instead of saving xml to file
Participant
,
/t5/coldfusion-discussions/using-cfcontent-instead-of-saving-xml-to-file/td-p/404928
Feb 29, 2008
Feb 29, 2008
Copy link to clipboard
Copied
I am trying to use cfcontent instead of saving the xml as a
file:
Quote "you can use <cfcontent type="text/xml"> and just output the XML directly, this means everytime the page is called it is always as up to date as the database"
I am using the code below but get an xml error-what is going on? Thanks.
<cfparam name="url.monthnowis" default="2">
<cfparam name="url.daynowis" default="22">
<cfcontent type="text/xml">
<cfquery name="getcountries" datasource="mydts">
SELECT clientinfo.countryid, clientinfo.visit
FROM clientinfo
WHERE month(clientinfo.visit) = <cfqueryparam value = "#url.monthnowis#" CFSQLType =
"cf_sql_integer" maxLength = "2" null = "No" list = "No">
<cfif url.daynowis neq "">
AND day(clientinfo.visit) = <cfqueryparam value = "#url.daynowis#" CFSQLType =
"cf_sql_integer" maxLength = "2" null = "No" list = "No">
</cfif>
GROUP BY countryid
</cfquery>
<cfxml variable="MyXMLDoc">
<?xml version='1.0' encoding='utf-8' ?>
<map>
<cfoutput query="GetCountries">
<country name="#countryid#">
<title>#country#</title>
<color>0xFF0000</color>
</country>
</cfoutput>
</map>
</cfxml>
</cfcontent>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=7,0,0,0"
width="640" height="300" id="loadworldmap" align="middle">
<param name="allowScriptAccess" value="" />
<param name="movie" value="loadworldmap.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#AFA5FE" />
<embed src="loadworldmap.swf" quality="high" bgcolor="#fffff" width="400" height="350"
name="loadworldmap" align="middle" allowScriptAccess="true" type="application/x-shockwave-flash"
pluginspage=" http://www.macromedia.com/go/getflashplayer" />
</object>
Quote "you can use <cfcontent type="text/xml"> and just output the XML directly, this means everytime the page is called it is always as up to date as the database"
I am using the code below but get an xml error-what is going on? Thanks.
<cfparam name="url.monthnowis" default="2">
<cfparam name="url.daynowis" default="22">
<cfcontent type="text/xml">
<cfquery name="getcountries" datasource="mydts">
SELECT clientinfo.countryid, clientinfo.visit
FROM clientinfo
WHERE month(clientinfo.visit) = <cfqueryparam value = "#url.monthnowis#" CFSQLType =
"cf_sql_integer" maxLength = "2" null = "No" list = "No">
<cfif url.daynowis neq "">
AND day(clientinfo.visit) = <cfqueryparam value = "#url.daynowis#" CFSQLType =
"cf_sql_integer" maxLength = "2" null = "No" list = "No">
</cfif>
GROUP BY countryid
</cfquery>
<cfxml variable="MyXMLDoc">
<?xml version='1.0' encoding='utf-8' ?>
<map>
<cfoutput query="GetCountries">
<country name="#countryid#">
<title>#country#</title>
<color>0xFF0000</color>
</country>
</cfoutput>
</map>
</cfxml>
</cfcontent>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=7,0,0,0"
width="640" height="300" id="loadworldmap" align="middle">
<param name="allowScriptAccess" value="" />
<param name="movie" value="loadworldmap.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#AFA5FE" />
<embed src="loadworldmap.swf" quality="high" bgcolor="#fffff" width="400" height="350"
name="loadworldmap" align="middle" allowScriptAccess="true" type="application/x-shockwave-flash"
pluginspage=" http://www.macromedia.com/go/getflashplayer" />
</object>
TOPICS
Getting started
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/using-cfcontent-instead-of-saving-xml-to-file/m-p/404929#M36387
Feb 29, 2008
Feb 29, 2008
Copy link to clipboard
Copied
I rarely use cfcontent but when I do, it's the last tag on
the page. Based on your narrative, you might be better off with
cffile.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Hydrowizard
AUTHOR
Participant
,
LATEST
/t5/coldfusion-discussions/using-cfcontent-instead-of-saving-xml-to-file/m-p/404930#M36388
Feb 29, 2008
Feb 29, 2008
Copy link to clipboard
Copied
I´ll try it as the last tag on the page. If I use
cfsavecontent and surround the XML to create a variable name and
then use cffile to write that ccfcontent variable as a file then
the data is not going to be updated in map.xml (the xml file) in
time for the flash map:
http://www.leavethatthingalone.com/worldmap/
It seems that there is a lag as well updating xml docs which seems to put a spanner in the works.
What do you suggest maestro?!
http://www.leavethatthingalone.com/worldmap/
It seems that there is a lag as well updating xml docs which seems to put a spanner in the works.
What do you suggest maestro?!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

