你可以隔离代码从CF10编译器看到吗? [英] Can you isolate code from being seen from CF10 compiler?

查看:213
本文介绍了你可以隔离代码从CF10编译器看到吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的雇主的客户想要上传多个文件处理



所以使用CF11,我可以使用uploadAll和可选的continueOnError值,错误可以轻松处理多个文件。



问题是,我的雇主的测试服务器仍然只有CF10,可能不会很快更新。因此,在我们的测试服务器上编译时,continueOnError和Error将失败。



我希望能够执行类似的操作:

 < cfif SERVER.ColdFusion.ProductVersion gte 11> 
< optimal cffile uploadAll code>
< cfelse>
< suboptimal cffile uploadAll code>
< / cfif>

并没有编译的任何问题。但是测试服务器有代码的问题。有什么办法,这可以在代码内完成吗?

解决方案

使用< cfinclude>

 < cfif SERVER.ColdFusion.ProductVersion gte 11> 
< cfinclude template =newWay.cfm>
< cfelse>
< cfinclude template =oldWay.cfm>
< / cfif>

这是cfbackport的功能:https://github.com/misterdai/cfbackport/blob/master/cfbackport.cfm


So I'm new to coding in coldfusion, this being my second month, so bear with me on this.

My employer's client wants to upload multiple files handling errors smoothly, meaning that it will continue on through all the uploads even if there was an error.

So with CF11, I can use uploadAll with the optional values of continueOnError and Errors enabled to handle the multiple files easily.

Problem is, is that my employer's testing server is still only CF10, and might not get updated anytime soon. So continueOnError and Error will fail on compile on our testing server, but not on the clients server.

I would like to be able to do something like:

<cfif SERVER.ColdFusion.ProductVersion gte 11>
    <optimal cffile uploadAll code>
<cfelse>
    <suboptimal cffile uploadAll code>
</cfif>

And not have any problems with compiling. But the testing server has a problem with the code anyway. Is there any way that this can be done within the code? If not, is there a way that I can do this fairly easily...ish?

解决方案

Use <cfinclude>.

<cfif SERVER.ColdFusion.ProductVersion gte 11>
    <cfinclude template="newWay.cfm">
<cfelse>
    <cfinclude template="oldWay.cfm">
</cfif>

This is how cfbackport does it: https://github.com/misterdai/cfbackport/blob/master/cfbackport.cfm

这篇关于你可以隔离代码从CF10编译器看到吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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