Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 1258

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
A MIME content type consists of
• text/html
• image/gif
• application/pdf
Changing the MIME content type with cfcontent
You use the
tag to change the MIME content type that returns to the browser along with the content
cfcontent
generated from your ColdFusion page.
The
tag has one required attribute,
cfcontent
Change the MIME content type with cfcontent
Create an HTML page with the following content:
1
<h1>cfcontent_message.htm</h1>
<p>This is a <em>test message</em> written in HTML.</p>
<p>This is the <em>second paragraph</em> of the test message.
As you might expect, it is also written in HTML.</p>
2
Save the file as cfcontent_message.htm in the myapps directory under your web_root.
The ColdFusion file that you write in steps 3 through 7 calls this file.
3
Create a ColdFusion page with the following content:
<html>
<head>
<title>cfcontent Example</title>
</head>
<body>
<h3>cfcontent Example</h3>
<cfcontent
type = "text/html"
file = "C:\CFusion\wwwroot\myapps\cfcontent_message.htm"
deleteFile = "No">
</body>
</html>
If necessary, edit the
4
file =
5
Save the file as cfcontent.cfm in the myapps directory under your web_root and view it in the browser.
The text of the called file (cfcontent_message.htm) displays as normal HTML.
6
In cfcontent.cfm, change
Save the file and view it in the browser (refresh it if necessary).
7
The text displays as unformatted text, in which HTML tags are treated as text.
The following example shows how the cfcontent tag can create an Excel spreadsheet that contains your data.
Create an Excel spreadsheet with cfcontent
1
Create a ColdFusion page with the following content:
format. The following are common MIME content types:
"type/subtype"
, which defines the MIME content type returned by the current page.
type
line to point to your myapps directory.
to
type = "text/html"
type = "text/plain"
Last updated 1/20/2012
.
1253

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents