User Guide
Installing Custom Tags 187
Access to generated content
Custom tags can access and modify the generated content of any of its instances
using the
thisTag.GeneratedContent variable. In this context, the term generated
content means the results of processing the body of a given tag. This includes all text
and HTML code in the body, the results of evaluating ColdFusion variables,
expressions, and functions, and the results generated by descendant tags. Any
changes to the value of this variable results in changes to the generated content.
thisTag.GeneratedContent is always empty during the processing of a start tag. Any
output generated during start tag processing is not considered part of the tag’s
generated content.
As an example, consider a tag that comments out the HTML generated by its
descendants. Its implementation could look something like this:
<cfif thisTag.ExecutionMode is ’end’>
<cfset thisTag.GeneratedContent =
’<!--#thisTag.GeneratedContent#-->’>
</cfif>
Installing Custom Tags
Custom tags are just like other cfm files except that they must be installed in a
specific location to be accessible from the calling page. Because ColdFusion loads
the first instance it finds of the custom tag called by a page, you should avoid placing
copies of a custom tag in different locations.
Local tags
The ColdFusion engine first searches for a custom tag in the directory of the calling
page. This allows you to keep a custom tag file in the same directory as the page that
uses it.
Shared tags
To share a custom tag among applications in multiple directories, place it in the
Custom Tags folder under your ColdFusion installation directory, for example
C:\CFUSION\CustomTags. You can create subfolders to organize custom tags.
ColdFusion searches recursively for the Custom Tags directory, stepping down
through any existing subdirectories until the custom tag is found.