Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFILE output- any way to format

Status
Not open for further replies.

geokor

Programmer
Aug 16, 2000
126
0
0
US
Is there anyway to format the output of a CFFILE action APPEND? I'm putting together an error log module and the output is messy:
TYPE OF ERROR::EXPRESSION ERROR MESSAGE::<P>An error occurred while evaluating the expression:
<P><PRE>#Idontexist#
</PRE></P></P>Error near line 11, column 13.<HR><P>Error resolving parameter <B>IDONTEXIST</B><P><P>ColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either: <OL><LI> You have misspelled the parameter name, or <LI> You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.</OL><P>___DETAILED ERROR MSG::___DATE::{ts '2000-10-24 11:59:35'}

Even simply being able to eliminate the HTML tags would be a big help. Any ideas? Anyone?
[sig][/sig]
 
You could alwasy use the replace function to strip the offending tags out e.g,

<CFSET FormatedErrorMsg = Replace(OriginalErrMsgVar, &quot;<P>&quot;, &quot;&quot;, ALL)>

You could alternatively put in line breaks like this:
<CFSET FormatedErrorMsg = Replace(OriginalErrMsgVar, &quot;<P>&quot;, &quot;\n\n&quot;, ALL)>

Then append the FormatedErrorMsg variable to the file.
Just do it for every tag you want to remove, unfortunately this relies on you knowing what tags will be present in the message.

I'm sure i saw a function to strip html code but i cant remember what it was, if i remember i'll post.

Hope this helps
 
Actualy...Much simpler to do:
<CFSET ErrorMsgVar = Replace(ErrorMsgVar, &quot;<P>&quot;, &quot;&quot;, ALL)>

etc, etc...
 
just noticed that i'm mixing languages...

dont use &quot;\n\n&quot;

use
Chr(10) for line feeds
Chr(13) for carriage returns
Chr(9) for tabs

e.g, <CFSET ErrorMsgVar=Replace(ErrorMsgVar, &quot;<BR>&quot;, Chr(10), &quot;ALL&quot;)>

Also note that ALL should be in quotes
Sorry about the errors...this is the last time i'll correct myself;-)
rgds
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top