到目前为止,我已经测试了几个页面,似乎无论我在哪里尝试使用<CFHTMLHEAD>将CSS或JavaScript添加到ColdFusion 11中的CFM页面,它都不会添加它(在CF8中很好)。
我继续读到从缺省值1024 SO增加Administrator > Server设置> Settings中的“最大输出缓冲区大小”,但是我尝试过的每一个值(2048 SO、4096 SO,甚至允许的最大值999999KB)都会得到相同的结果--当页面加载时,内容不包含在<HEAD>标记中。
还有其他人遇到这个问题并找到解决办法了吗?
代码示例:
htmlhead.cfm:
<cfif NOT ThisTag.HasEndTag>
<cfthrow message="Missing end tag for custom tag htmlhead." type="HeadWrap" />
</cfif>
<cfif ThisTag.ExecutionMode is "End">
<cfhtmlhead text="#ThisTag.GeneratedContent#" />
<cfset ThisTag.GeneratedContent = "" />
</cfif>index.cfm:
<cfsilent>
<!---
Data Retrieval, validation, etc. here
--->
<cf_htmlhead>
<style type="text/css">
tr.status-RETIRED td {
color: #800000;
}
tr.status-PENDING td {
color: #008000;
}
</style>
<script type="text/javascript">
$(function(){
$(".options-menu").mouseleave(function(e){
$(this).hide("fast");
})
$(".options-menu-link").mouseover(function(){
$(".options-menu").hide("fast");
$(".options-menu[data-sku='" + $(this).data("sku") + "']").show("fast");
}).click(function(e){
e.preventDefault();
});
});
</script>
</cf_htmlhead>
</cfsilent>
<!---
Custom Tag layout.cfm contains the DOCTYPE declaration, html, head (loads jquery, jquery-ui, css, etc.), and body tags with a header and footer for each page.
--->
<cf_layout>
<!--- Page Content Here (a form, a table, some divs, etc.) --->
</cf_layout>发布于 2015-01-23 00:35:05
我发现在CF11中,在cfcontent reset="true“之前使用cfhtmlhead调用添加的任何内容都不会添加到结果文档中。在您的cf_layout包含内容重置后调用的cf_htmlhead标记吗?
例如,
<!--- This will not be added under CF11. --->
<cfhtmlhead text="<!-- I'm some content that will only be included in CF10 or lower. -->">
<cfcontent reset="true">
<!--- This will be added under CF11 and lower. --->
<cfhtmlhead text="<!-- I'm some content that will be added in CF11 and lower. -->">
... the rest of your view code ...
<!--- This is a sample of the content you will get under CF11 --->
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Head Testing</title>
<!-- I'm some content that will be added in CF11 and lower. -->
</head>
<body>
<h1>Page content</h1>
</body>
</html>https://stackoverflow.com/questions/27713753
复制相似问题