Three things:
1. You need to re-think your database design. I have had this issue one
time in the past I since came to realize that it was bad database design.
You should never have to store CF that needs to be evaluated in the
database.
2. It is possible to write a text parser that strips CF variables out of
text then evaluates them and puts them back in as values, but it is
processor and developer intensive and is a terrible solution to a problem
that shouldn't exist.
3. I see by your example that you are wanting to put application.imagesRoot
in the DB and have it evaluated when pulled out again. You may want to
evaluate it before you put it in (use IF statements to determine what it
should be if you know where it will be displayed) , or create a dedicated
image server (images.yourDomain.com) that can always be the same regardless
of server location, or store the images in a seperate DB table, or use
relative pathing to avoid the problem altogether.
Take it from someone who has been there and go back before you get too far
down this road, you'll find nothing but headaches at the end!
Bryan Love ACP
Internet Application Developer
[EMAIL PROTECTED]
-----Original Message-----
From: Christian N. Abad [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 11:57 AM
To: CF-Talk
Subject: Parsing a text field from a db...
Folks:
Here is today's challenge :
I have a database that stores Library articles (how-to's).
I need to be able to store ColdFusion markup in the database and have it
parsed once the row is retrieved from the database.
For example, I store the following text in the db:
<img src="#application.imagesRoot#/library/image.gif">
Then, I retrieve this Library item from the db with a query and display it,
like this :
<cfoutput>#myQueryName.article#</cfoutput>
PROBLEM : The text that is written to the html file the LITERAL text from
the database. Instead, I need to have this text parsed and interpreted as
CFML.
Does this make sense?
Any ideas?!
Thanks!
Christian N. Abad
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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