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

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

问题描述

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

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

即.

<CFSET page_title = "TITLE"><CFSET 示例变量 = "ABC"><CFSET 内容><!--类似这样的东西-->

一堆没有任何 cf 标签的内容</div></CFSET><cfinclude 模板="include/layout.cfm"></cf输出>

解决方案

<cfsavecontent variable="header"><cf输出>我可以是 HTML、javascript 任何文本.记住要转义磅符号,即:##FF0000 而不是 #FF0000我什至可以 <cfinclude template="headerpage.cfm">并将存储在变量中称为标题</cf输出></cfsavecontent><cfoutput>#header#</cfoutput>

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;

ie.

<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天全站免登陆