Honestly, I have never needed to do this myself, but apparently many ColdFusion users have, and several have asked me for advice in the past few days. So ...
If you were to store CFML source code in a database so that it may be retrieved via a simple database query, what would be the best way to execute that code? You could, of course, write the code to a temporary file and then it, but that's a hack at best. It also may be possible to parse the text so as to evaluate() any expressions, but that won't work well with tags.
Whether this is a good practice or not is debatable and a separate discussion. For now, has anyone discovered a creative way to do this? If so, please share.
Although this is a possible solution, people which are looking for this kind of solutions should better take a look at their application, and the way it is build up.
I'm with Micha on this - folks should take a look at their application and rethink their solution.
Perhaps use another solution for indexing and searching aside from a database?
Dear #UserFirstName#
bla,bla,bla
Users knows not to mess with anything in # signs, but when I put this in the cfmail tag from the the db it does'nt work, just sends out the raw cf code
Any suggestions ?
Dharmesh
dharmesh42@hotmail.com
- Regarding WHY one would want to do this, consider a content management solution where the customer can 'build' his own mini-site by picking from several pleasing frame arrangements and selecting one of your modules (such as a catalog interface, a calendar, a text area for a message to patrons) to use in each frame. The customer supplies content for some of these modules, editing text and uploading images through forms provided by the Web host (you!). The site description dialogue can store the customer's input in a database and use it to generate (or regenerate) the site when the description is complete.
- Tupperware provides this kind of functionality to its consultants (although not with ColdFusion). See http://my.tupperware.com/AnnMarieLadner [shameless plug] for an example. To be fair, I should point out that an outside agency keeps her content fresh, proving that even niches have niches.
- Consider that there are MANY small firms that could benefit from having their own useful Web presence but can't afford to pay technical folks to keep them up to date. Further, Yahoo is reportedly getting out of this business. You could help your community and probably break even (or better) by providing this kind of service. =Marty=
<cfquery name=myQuery ... >
select bodyText from table
</cfquery>
<cfmail ... >
#evaluate(de(myQuery.bodyText))#
</cfmail>