Link to home
Start Free TrialLog in
Avatar of cfmdev
cfmdev

asked on

Can you write code dynamically?

Instead of writing a series of if statements, I'd like to dynamically loop over a query and have the code written to the template at run time...so in stead of writing a bunch of:

<cfif condition>do this</cfif>
<cfif condition>do this</cfif>

statements in the template I'd rather do this:

<cfloop query="somequery">
<cfif fieldname>do this</cfif>
</cfloop>

and write this to the template...

Is this possible?

Avatar of cfmdev
cfmdev

ASKER

Perhaps a solution to this problem would be to write the results of the query to a file and then in the template where I would have hard-coded the conditionals, read the file and then output the results on the page as text? Not sure...was hoping someone had done this before...
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial