WDDXFileWrite(file, var)
Last updated October 15, 2002
Version: 2 | Requires: ColdFusion MX | Library: CFMLLib
Description:
Ever get annoyed at the couple of lines you are always writing to store and retrieve WDDX in flat files? Then this is the UDF for you. Also see it's sister UDF WDDXFileRead().
Return Values:
Does not return a value.
Example:
hello = structNew();
hello.foo.bar = 2;
hello.thing = "a string";
// wddxfileWrite(expandPath("test.wddx"),hello);
// stuff = WDDXFileRead(expandPath("test.wddx"));
</cfscript>
<!---
<cfdump var="#stuff#">
--->
Parameters:
| Name | Description | Required |
|---|---|---|
| file | The file to write to. | Yes |
| var | The value to serialize. | Yes |
Full UDF Source:
<!---
Write a flat file containing a WDDX packet of any CF variable
Updated for CFMX var scope syntax.
@param file The file to write to. (Required)
@param var The value to serialize. (Required)
@return Does not return a value.
@author Nathan Dintenfass (nathan@changemedia.com)
@version 2, October 15, 2002
--->
<cffunction name="WDDXFileWrite" output="no" returnType="void">
<cfargument name="file" required="yes">
<cfargument name="var" required="yes">
<cfset var tempPacket = "">
<!--- serialize --->
<cfwddx action="cfml2wddx" input="#var#" output="tempPacket">
<!--- write the file --->
<cffile action="write" file="#file#" output="#tempPacket#">
</cffunction>
Search CFLib.org
Latest Additions
Shawn Porter added
DeMoronize
3 hour(s) ago
Chris Carey added
readPropertiesFi...
1 day(s) ago
Randy Johnson added
lastDayofWeek
3 day(s) ago
Frank Marion added
sitemapPing
7 day(s) ago
Top Rated
QuickSort
Rated 5.0, 3 time(s)
indentXml
Rated 5.0, 3 time(s)
queryColumnsToSt...
Rated 5.0, 3 time(s)
generateSsccAsn
Rated 5.0, 3 time(s)