Accessibility
 
Home > Products > UltraDev > Support > Working with Server-Side Technologies
Generator Icon Macromedia Generator Support Center - Working with Server-Side Technologies
CFX_Generate Tag Syntax

CFX_Generator tags
Use the CFX_Generate tag in ColdFusion applications to create graphics using the offline Generator. The CFX_Generate tag has the following attributes:

CFX_Generate syntax
TEMPLATE [required] The full path and file name of the Generator template file (*.swt)
TYPE [required] File type for output (jpg, gif, swf, png, txt, cmap, smap, xwin32, xwin16, xmac68K, xmacppc, xmacfat )
FILE [required] Full path and file name for the output file (include extension)
CMAPNAME [optional] Tag name for client side image map
DEBUGLEVEL [optional] Sets debug level. Valid values are 1, 2, 3
. LOGFILE [optional] Full path and file name for error log
QUERY: [optional] Name of CF Query that contains the parameters to pass to Generator. Query must have two fields, named NAME and VALUE.

The following example invokes the Offline Generator, creating the Flash Player movie mygraphic.swf from the Generator template.swt.

<CFX_Generate
TEMPLATE="c:\webroot\mytemplate.swt"
TYPE="swf"
FILE="c:\webroot\mygraphic.swf">

This is equivalent to the command:

generate -swf mygraphic.swf mygraphic.swt


Passing parameters to Generator
Parameters are passed to the Offline Generator in the form of a query. The query will always have two columns, name and value. Each row in the query represents one parameter to be passed to the Offline Generator.

<CFQUERY NAME="GETPARAMS" DATASOURCE="GENDATA">
select name, value
from usergendata
where user=#userid#
</CFQUERY>

<CFX_Generate
TEMPLATE="c:\webroot\mytemplate.swt"
TYPE="swf"
FILE="c:\webroot\mygraphic.swf"
QUERY="getparams">

Assume that the query GETPARAMS in the previous example returned one row containing the data [param1, foodata1], in columns name and value. Param1 is the name of a variable in the Generator template and foodata1 is the value assigned to that variable. This is equivalent to the command:

generate -param param1 foodata1 -swf mygraphic.swf mygraphic.swt

Alternatively, the query values may be set directly by using the following form:

<CFSET getparams = QueryNew("NAME,VALUE")>
<CFSET Temp = QueryAddRow(getparams)>
<CFSET Temp = QuerySetCell(getparams,"NAME","param1")>
<CFSET Temp = QuerySetCell(getparams,"VALUE","foodata1")>


Using Generator Logging
The Offline Generator includes a logging function. It will write to a text file any messages that would have been returned to the command line interface. If the generation is successful, nothing at all will be written. Logging requires both attributes: LOGFILE and DEBUGLEVEL. Note that Generator will not append to this file. To log multiple Generations you need to provide a distinct logfile name for each, or write to a temp file and append to the master log file. Here is an example of the syntax.

<CFX_Generate
TEMPLATE="c:\webroot\mytemplate.swt"
TYPE="swf"
FILE="c:\webroot\mygraphic.swf"
LOGFILE="c:\webroot\mylog.txt"
	DEBUGLEVEL="3">


Client Side Image Maps
Generator can output client side image maps. Generator writes the HTML that implements the map. To name the map, use the CMAPNAME attribute.

General notes on using the CFX_Generate tag

The path to the folder containing generate.exe must be in the system path.
Full paths are required for all files specified as attributes.
Log files are overwritten, not appended to.
In general, unneeded attributes are ignored.
A DOS window opens briefly during generation.
Type Generate at the command line for a full list of Generator options.

Macromedia

12/14/1998

Generator, Cold, Generator, Cold Fusion