Coldfusion And Xml

Joined: 11/28/2008
User offline. Last seen 1 year 5 weeks ago.

A friend of mine is trying to make a flash image rotator work on a website that runs on ColdFusion. The plan is to output the file as XML and the portion that lists the images would be dynamic in that they're different each page load or each week. Can anyone offer some suggestions? I have on idea that I haven't passed, but wanted to get actual CF developers input (since I'm a PHP guy).

Who can bring a charge to God's elect? It is God who justifies!

Joined: 11/28/2008
User offline. Last seen 1 year 2 days ago.
What you want to do is make

What you want to do is make use out of the cfxml tag. You can dynamically create xml documents within those tags, then output that xml to a string, then write that string to a file. You code might look something like this:

CODE
<CFXML variable="inputxml">
<?xml version="1.0" encoding="UTF-8"?>
<root>
<parent>
    <child></child>
    <child></child>
</parent>
</root>
</cfxml>

<!--- write the string out to a file.--->
<cffile action="write" file="\path\to\your\file.xml" output="#ToString(VARIABLES.INPUTDATA)#">

To make it dynamic, you can use conditions and/or loops within xml document itself. Off the top of my head, I think I would load whatever image paths their are into an array, then shuffle the array elements. Just a thought.

Hope this helps!

Joined: 11/28/2008
User offline. Last seen 1 year 5 weeks ago.
Thanks Paul, I'm passing this

Thanks Paul, I'm passing this on to my friend to see what he thinks.

Who can bring a charge to God's elect? It is God who justifies!