Let's say, for example, you have a text file. One that contains some CFML code in it, but you know Railo Server won't parse it. This text could come from a database as a variable or from a file. In this example, we are just going to use a file to make it easy. Because Railo Server won't parse TXT files, this makes for a good example:
1. Create a file named
blogpost.txt
in yourChapter_8
folder and put the following code in it:The time now is <cfoutput>#Now()#</cfoutput>
2. Now, let's read the file and display it; let's create a template named
listing_08_14.cfm
in theChapter_8
folder and put the following code to display the contents of the file:<cfset myBlogPost = FileRead("blogpost.txt")> <cfoutput>#myBlogPost#</cfoutput>
3. When you run this template by going to
http://localhost:8888/chapter_8/listing_08_14.cfm
, you get the following displayed:4. This is not quite what we want to be displayed. We would have...