我想知道是否可以根据 ColdFusion 中加载到索引页的内容从环绕页面页脚中排除数据
大概是这样的。
IF (not = pageToBeExcluded)
THEN {
Show content
}
最佳答案
有很多方法可以做到这一点。
最简单的可能是键入页面地址。
<cfif CGI.SCRIPT_NAME DOES NOT CONTAIN "someArbitraryPage.cfm">
<!--- show this content --->
...
</cfif>
如上所述,您可能需要使用 getCurrentTemplatePath()
或 getBaseTemplatePath()
。
就个人而言,我可能会在模板中设置一个我希望发生这种情况的变量。这样做的主要好处是,每次我从我想要的文件列表中添加(或删除)文件时,我不需要不断更改页脚代码。
<!--- in the template itself --->
<cfset request.suppressFooterContent = true>
然后,在页脚中:
<cfparam name="request.suppressFooterContent" default="false">
<cfif NOT request.suppressFooterContent>
<!--- display content here --->
...
</cfif>
关于coldfusion - 如果查看某个页面则排除内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14220469/