我有以下两种CFC:
component extends="Controller" displayName="foo" {
public void function minifoo() {
}
}
component extends="Foo" displayName="bar" {
public void function minibar() {
}
}
Run Code Online (Sandbox Code Playgroud)
我知道Foo.cfc中的任何函数都可供Bar.cfc使用.但似乎反过来并非如此.我可以在Bar.cfc中使用Foo.cfc中的函数吗?或者继承只能以一种方式工作?
我想从这里学习cf.http和cf.query .
我试过以下代码:
<cfscript>
result = CF.http({method:"get", url:"http://google.com" });
</cfscript>
<cfdump var="#result#">
Run Code Online (Sandbox Code Playgroud)
但我得到错误:
在第33行的第2行找到无效的CFML构造.
仅供参考:我的coldfusion服务器版本:9,0,1,274733
会是什么问题?
我如何使用CF ORM执行以下操作?
SELECT * FROM products WHERE id in ('3,7,12,5');
Run Code Online (Sandbox Code Playgroud)
我试过了
EntityLoad("products", { id in ('#productIDlist#') });
Run Code Online (Sandbox Code Playgroud)
但没有Joy ..得到错误: Invalid construct: Either argument or name is missing. When using named parameters to a function, each parameter must have a name.
..我确信这是直截了当的,但我无法解决如何做到这一点,并找不到任何样本或文档.
提前谢谢了.
我的JSON包含特殊字符,如:新行,双引号等.
我正在使用Coldfusion服务器端脚本创建JSON.但是在特殊字符的情况下,由于格式错误的JSON,我会收到错误.在这种情况下我该怎么办?
<cfoutput>
[
<cfset loopIndex=0>
<cfloop query="qEvents">
<cfif loopIndex NEQ 0>,</cfif>
<cfif is_allday EQ 1>
<cfset isallDayEvent = "true">
<cfelse>
<cfset isallDayEvent = "false">
</cfif>
{
"title": "#title#",
"start": "#DateFormat(start_date_time,'mm/dd/yyyy')# #TimeFormat(start_date_time,'hh:mm tt')#",
"end": "#DateFormat(end_date_time,'mm/dd/yyyy')# #TimeFormat(end_date_time,'hh:mm tt')#",
"allDay": #isallDayEvent#,
"eventID": "#event_id#",
"duration": "#duration#",
"note": "#note#",
"location": "#location#"
}
<cfset loopIndex=loopIndex+1>
</cfloop>
]
</cfoutput>
Run Code Online (Sandbox Code Playgroud) (ACF9)
除非有一个我缺少的选项,"记录慢于[n]秒的慢速页面"设置对于基于前端控制器的站点没有用(例如,Model-Glue,FW/1,Fusebox,Mach-II,等等.).
例如,在Mura/Framework-One网站中,我最终得到:
"Warning","jrpp-186","04/25/13","15:26:36",,"Thread: jrpp-186, processing template: /home/mysite/public_html_cms/wwwroot/index.cfm, completed in 11 seconds, exceeding the 10 second warning limit"
"Warning","jrpp-196","04/25/13","15:27:11",,"Thread: jrpp-196, processing template: /home/mysite/public_html_cms/wwwroot/index.cfm, completed in 59 seconds, exceeding the 10 second warning limit"
"Warning","jrpp-214","04/25/13","15:28:56",,"Thread: jrpp-214, processing template: /home/mysite/public_html_cms/wwwroot/index.cfm, completed in 32 seconds, exceeding the 10 second warning limit"
"Warning","jrpp-134","04/25/13","15:31:53",,"Thread: jrpp-134, processing template: /home/mysite/public_html_cms/wwwroot/index.cfm, completed in 11 seconds, exceeding the 10 second warning limit"
Run Code Online (Sandbox Code Playgroud)
有没有办法在那里获取查询字符串或发布详细信息,还是有另一种方式来获取我所追求的内容?
coldfusion monitoring error-logging front-controller coldfusion-9
我正在使用 CF9 和 ColdBox。我正在做的是循环查询,并在最后使用cfdocumentitem pagebreak. 但是,它总是在最后给我一个额外的空白页。这几乎让我发疯,所以我听从专家的建议。
<cfdocument format="PDF" overwrite="Yes" localUrl="yes" pageType = "letter">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<cfquery name="Receipts" dbtype="query">
SELECT distinct id_number
FROM rc.RC1
</cfquery>
<cfoutput>
<cfloop query="Receipts">
<!--- removed for brevity --->
<cfdocumentitem type="pagebreak" />
</cfloop>
</cfoutput>
</body>
</html>
</cfdocument>
Run Code Online (Sandbox Code Playgroud) 我试图传递JSON数据的值cfhttpparam如下:
Line #95: <cfhttpparam type="formfield"
name="seriesofdata"
value="[{"Id": 118,"Value": 1,"Desc": "Checking Description ","Group": 1}]"/>
Run Code Online (Sandbox Code Playgroud)
但我继续收到以下错误:
Invalid token " found on line 95 at column XX.
Run Code Online (Sandbox Code Playgroud)
我已经检查了JSON,它是我作为值传递的有效JSON.
我究竟做错了什么?
我有一些从数据库中获取的文本,想插入到 HTML 页面中。我HTMLEditFormat用来处理特殊字符,如 '<' 等...
问题:当这在浏览器中显示时,所有换行符都消失了。CF 中是否有特殊的格式化功能可以自动用正确的 HTML 标签替换所有换行符?
我有一个表单,用户必须从列表中选择值.列表由管理员创建.在其中一个列表中,有一个选项供用户选择NO代表某些保留代码的值.有点像Not Occupied.所以我使用JQuery和AJAX与服务器进行通信.在后端我在生产服务器上使用ColdFusion 9.所以为了带回来,NO我必须将其转换'NO '为空间.如果我不这样做,则会false在客户端返回值.以下是我的代码转换示例:
<cfset convertYesNo = {
YES : "YES ",
NO : "NO "
}>
<cfset qryRecs['value'] = URLEncodedFormat(structKeyExists(convertYesNo, myInfo[CurrentRow]) ? convertYesNo[myInfo[CurrentRow]] : myInfo[CurrentRow])>
Run Code Online (Sandbox Code Playgroud)
上面的代码在我的开发网站上运行良好.唯一的区别是,在发展我们的ColdFusion 10和现场我们的ColdFusion 9,所以一旦我搬到一起住,我开始收到错误消息的代码:
ColdFusion was looking at the following text:<p>{</p><p>The CFML compiler was processing:<ul><li>A cfset tag beginning on line 1071, column 18.<li>A cfset tag beginning on line 1071, column 18.
<pre>1069 : }>
1070 :
<b>1071 : <cfset convertYesNo = {</b>
1072 : "Yes" …Run Code Online (Sandbox Code Playgroud) 我想将秒转换为天、小时和分钟 目前,它仅适用于小时和分钟,但不适用于天。你能支持我吗?告诉我我做错了什么:
<cfscript>
seconds = '87400';
midnight = CreateTime(0,0,0);
time = DateAdd("s", seconds, variables.midnight);
date= xxxxxxxxxxxxxxxxxxxxx???
</cfscript>
<cfoutput>
#DateFormat(variables.date, 'd')# not working
#TimeFormat(variables.time, 'HH:mm')#
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
对于该值,87400预期结果是
如果我花94152几秒钟,它将是:
我唯一的问题是获得正确的日期...显示小时和分钟,但不是正确的日期
感谢大家的支持
在我的表单中,我有一个带方括号的元素:
<input name="bodyIDList[]" id="bodyIDList" value="">
Run Code Online (Sandbox Code Playgroud)
当我将此页面传递给ColdFusion时,如何将其视为表单变量?作为列表还是数组?
Now()ColdFusion中的函数是否区分大小写?我可以用now()而不是Now()吗?
好吧,我正在开发一个coldfusion页面,但是,我在那里做的大部分内容都与HTML有关.因此想知道,有没有办法,我可以在coldfusion页面中插入JPEG图像?
我看到了这个文件,但它是用于ZIP文件:http://www.bennadel.com/blog/1464-Embedding-ZIP-Files-Inside-JPG-Files-Using-ColdFusion.htm
请让我知道如何实现这一目标?
我如何获得图像:
基本上我已经提供了一个MS Word文档,里面有一个小的信用卡大小的图像.因此,我已将该图像复制并粘贴到Paint上,然后裁剪该图像以保持大小,然后将其保存为JPEG格式.我希望我遵循的程序很好.
更多澄清:
这个HTML/Coldfusion页面将被用作电子邮件编辑器中的模板并将被发送.我只是想知道img在下面的答案中建议使用标签是否仍然适用于这种情况?我希望现在听起来不是100%不同的问题?
coldfusion ×13
coldfusion-9 ×13
cfc ×1
cfdocument ×1
cfml ×1
coldfusion-8 ×1
date ×1
fullcalendar ×1
html ×1
http ×1
inheritance ×1
line-breaks ×1
monitoring ×1