通过Coldfusion中的cfset获取长/多行内容

时间:2011-01-06 21:24:59

标签: coldfusion

有没有办法用cfset设置一个更像cdata标签的变量

还是有另一种方法可以让页面设置一些基本变量,并为主要内容设置几个较长的变量;

<cfoutput>
<CFSET page_title = "TITLE">
<CFSET examplevariable = "ABC">

<CFSET content>
 <!--something like this-->
 <div>
   bunch of content without any cf tags
 </div>
</CFSET>

<cfinclude template="include/layout.cfm">

</cfoutput>

1 个答案:

答案 0 :(得分:15)

<cfsavecontent variable="header">
  <cfoutput>
     I can be HTML, javascript anything text.
     remember to escape pound sysmbols ie: ##FF0000 instead of #FF0000
     I can even <cfinclude template="headerpage.cfm"> and will be stored in variable 
     called header
  </cfoutput>
</cfsavecontent>

<cfoutput>#header#</cfoutput>