ColdFusion dynamic variables

coldfusion dynamic variables

DynamicVariables.cfm


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>coldfusion dynamic variables - how to create and use in coldfusion</title>
</head>

<body>
<h2 style="color:DarkBlue; font-style:italic">coldfusion dynamic variables example: how to use</h2>
<hr width="500" align="left" color="LightBlue" />
<br />

<cfset ColorName="Crimson">
<cfset "#ColorName#"="Red type color">

<cfdump var="#Variables#">
<br />

<table border="0" cellpadding="2" cellspacing="2" bgcolor="DeepPink" width="250">
 <tr style="background-color:Crimson; color:Snow; font-size:large;">
     <td>Variable</td>
     <td>Output</td>
    </tr>
 <cfoutput>
        <tr style="background-color:OrangeRed; color:Snow;">
            <td>ColorName</td>
            <td>#ColorName#</td>
        </tr>
        <tr style="background-color:OrangeRed; color:Snow;">
            <td>Crimson</td>
            <td>#Crimson#</td>
        </tr>
 </cfoutput>    
</table>

</body>
</html>