Coldfusion中通过cfset的长/多行内容 [英] long/multiline content through cfset in Coldfusion

查看:68
本文介绍了Coldfusion中通过cfset的长/多行内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用cfset设置变量,使其更像是cdata标记

is there a way to set a variable with cfset that acts more like a cdata tag

或者是否可以通过设置一些基本变量的页面来设置为主要内容设置了两个较长的变量;

or is there another way of having a page with some basic variables set and a couple of longer variables set for the main content;

即。

<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>


推荐答案

<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>

这篇关于Coldfusion中通过cfset的长/多行内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆