我正在开发一个Mura插件,它使用mura标签来拉入一个组件并在页面上使用它。本质上,我的插件需要调用$.dspObject('component',Arguments.componentid)。由于mura作用域在plugin方法中不可用,所以我猜我需要引入一个组件bean,但我不知道该如何做。
<cffunction name="showPlayer" access="public" output="false" returntype="String">
<cfargument name="component" type="string" required="true" hint="The ID of the component that contains the playlist." />
<!--- Create the body content --->
<cfsavecontent variable="bodycode">
<cfoutput>#$.dspObject('component',Arguments.component)#</cfoutput>
</cfsavecontent>
</cffunction>这是该方法的一个非常精简的版本(完整的eventHandler可以在GitHub上找到。
那么我该如何重写代码来提取组件bean (或者我需要为它做的任何事情)呢?
发布于 2011-04-16 04:41:37
有几种可能的方法:
<cfargument name="$">或
var $=application.ServiceFactory.getBean(“muraScope”);或
var $=getServiceFactory().getBean(“muraScope”);或
var $=getBean(“muraScope”);请参阅MuraCMS Programmers Guide和cfobject.cfc
https://stackoverflow.com/questions/5668342
复制相似问题