User Guide

210 Chapter 2: ColdFusion Tags
cfhtmlhead
Description
Writes text to the head section of a generated HTML page.
Category
Page processing tags
Syntax
<cfhtmlhead
text = "text">
See also
cfcache, cfflush, cfheader, cfheader, cfinclude, cfsetting, cfsilent
Attributes
Usage
Use this tag for embedding JavaScript code, or putting other HTML tags, such as meta, link,
title, or base in an HTML page header.
If you use this tag after the
cfflush tag on a page, an error is thrown.
Example
<!--- This example displays the information provided by the Macromedia
Designer & Developer Center XML feed,
http://www.macromedia.com/devnet/resources/macromedia_resources.rdf
See http://www.macromedia.com/desdev/articles/xml_resource_feed.html
for more information on this feed. --->
<!--- Set the URL address. --->
<cfset urlAddress="http://www.macromedia.com/devnet/resources/
macromedia_resources.rdf">
<!--- Use the CFHTTP tag to get the file content represented by urladdress
Note that />, not an end tag. terminates this tag. --->
<cfhttp url="#urladdress#" method="GET" resolveurl="Yes" throwOnError="Yes"/>
<!--- Parse the XML and output a list of resources. --->
<cfset xmlDoc = XmlParse(CFHTTP.FileContent)>
<!--- Get the array of resource elements, the xmlChildren of the xmlroot. --->
<cfset resources=xmlDoc.xmlroot.item>
<cfset numresources=ArrayLen(xmlDoc.xmlRoot.xmlChildren)-1>
<cfloop index="i" from="1" to="#numresources#">
<cfset item=resources[i]>
<cfoutput>
<strong><a href=#item.link.xmltext#>#item.title.xmltext#</strong></a><br>
<strong>Author</strong>&nbsp;&nbsp;#item.creator.xmltext#<br>
Attribute Req/Opt Default Description
text Required Text to add to the <head> area of an HTML page.