Description
Appends text to the page-output stream. This function writes to the page-output stream regardless of conditions established by the cfsetting tag.
Category
Other functions, System functions, Data output functions
Function syntax
WriteOutput(string [,encodefor])
History
Introduced in ColdFusion 4.5
Parameters
Parameter |
Description |
---|---|
string |
A string or a variable that contains one. |
encodefor |
This parameter's functionality is similar to the ' encodeFor ' functions. The valid values are html , htmlattribute , url , javascript, css , xml , xmlattribute , xpath , ldap , and dn . Based on the respective value, the encoding will be applied on the input string. This parameter is optional. |
See also
- EncodeForHTML
- EncodeForHTMLAttribute
- EncodeForURL
- EncodeForJavaScript
- EncodeForCSS
- EncodeForXML
- EncodeForXMLAttribute
- EncodeForXPath
- EncodeForLDAP
- EncodeForDN
Usage
Within the cfquery and cfmail tags, this function does not output to the current page; it writes to the current SQL statement or mail text. Do not use WriteOutput within cfquery and cfmail. Although you can call this function anywhere within a page, it is most useful inside a cfscript block.
Example 1
<cfscript> // encodeFor=url writeoutput("encoding for url: "); writeoutput("lorem ipsum _*&%^$%&@","url"); </cfscript>
<cfscript> // encodeFor=html writeoutput("encoding for html: "); writeoutput("lorem ipsum _*&%^$%&@","html"); </cfscript>
<cfscript> // encodeFor=css writeoutput("encoding for css: "); writeoutput("lorem ipsum _*&%^$%&@","css"); </cfscript>
Output
encoding for css: lorem\20 ipsum\20 \5f \2a \26 \25 \5e \24 \25 \26 \40
Sign in to your account