保险丝盒在代码中调用保险丝 [英] Fusebox invoking a fuse within the code
问题描述
有人知道是否有可能在Coldfusion模板中调用融合吗?
Does anyone know if its possible to invoke a fuseaction within a coldfusion template?
推荐答案
(您尚未指定哪个Fusebox版本;此答案适用于Fusebox 5.x)
您的标题和问题在问两个不同的问题-融合和融合是两个不同的事物.保险丝只是CFML模板,而保险丝则代表一束执行特定动作(类似于功能)的逻辑.
Your title and question is asking two different things - a fuse and a fuseaction are two distinct things. A fuse is simply a CFML template, whilst a fuseaction represents a bundle of logic that performs a particular action (similar to a function).
要调用保险丝,只需像平常一样包括文件-不需要特殊的FB功能.
To invoke a fuse, simply include the file as you would normally - there's no special FB functionality required for this.
要调用融合,请使用 do 动词,如下所示:
To invoke a fuseaction, use the do verb, like so:
<cfset myFusebox.do('circuit.fuseaction') />
要存储结果,请对内容变量使用第二个参数:
To store the result, use the second argument for the content variable:
<cfset myFusebox.do('circuit.fuseaction',varname) />
这等效于此XML:
<do action="circuit.fuseaction" contentvariable="varname" />
还有其他可用参数,请参见 此Fusebox速查表 也包含许多其他有用的信息.
There are other arguments available, see this Fusebox cheat sheet which contains plenty of other useful info too.
这篇关于保险丝盒在代码中调用保险丝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!