Hello,
I've got some code that I'd like to make more maintainable and more
elegant.
In an included header file, I've got something like this (but much
more complicated and lengthy):
<!--- Which title banner to output at the top of the page? --->
<cfif findnocase("Dogs.cfm","#cgi.script_name#") GT 0>
<img src="images/doggies.gif" alt="Aww, cute dogs.">
<cfelseif findnocase("Cats.cfm","#cgi.script_name#") GT 0>
<img src="images/kitties.gif" alt="Aww, cute cats.">
<cfelseif findnocase("Fish.cfm","#cgi.script_name#") GT 0>
<img src="images/bigbass.gif" alt="Lunker">
<...snip...>
<cfelse>
<img src="images/default.gif" alt="Hello">
</cfif>
It would be nice to programmatically output these conditionals based
upon an array. I've got the array created already, and the result (in
a tabular representation) looks like this:
IMG, SCRIPT_NAME, ALT_TEXT
doggies.gif, dogs.cfm, "Aww, cute dogs."
cats.gif, cats.cfm, "Aww, cute cats."
bigbass.gif, fish.cfm, "Lunker"
<...snip...>
However, I don't know if it's possible to dynamically generate _CF
code_ and get it parsed. I could get it working with a cffile
workaround, but I don't think it would be worth it to pursue that
route.
I know that it's not possible to directly parse CF code from a
database source, and I suspect that the same rules apply here, but
please confirm.
Thanks,
Jamie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists