Excerpted from CF Advisor, date unknown.

Displaying "New Line" Characters on Output

Do you have a field in a database that you're trying to display (perhaps a "description") and you know in the database (perhaps Access), the data has carriage returns (new lines), but they don't display when you present the data with CFOUTPUT? Try using the CF function "paragraphformat". So instead of:
<CFOUTPUT> #description# </cfoutput>

Use: <CFOUTPUT> #paragraphformat(description)# </cfoutput>

This will return the text in "description" properly, converting single newline characters (CR/LF sequences) into spaces and double newline characters into HTML paragraph markers (<P>). The function is particularly useful within TEXTAREA tags.

Quick and Easy Indenting of Code

Indenting your code in CF is smart, and using the tab key to do so will work. But if you use Studio and really want to make indenting easy, you should know about these two features:
  1. You can set Studio to "auto indent", so that each new line you enter is indented at the same level as the previous line. Do this with Options>Settings. Select the "Editor" tab and check on "auto-indent".
  2. Similarly, if you need to indent several lines of code at once, highlight the lines and select Edit>Indent. This will indent the lines by one tab amount. If you use this often, you'll find the keyboard shortcut easier to use: Shift+Control+. (that's a period). You can use the same approach to "unindent" a group of lines, and its shortcut is Shift+Control+, (comma).
Tips Contents:

| Home | ColdFusion | Articles | Presentations
| User Groups | Other Resources | Press Releases | Company

© 1998-2024, Charles Arehart, SysteManage
Our Practice Makes You Perfect