我正在使用Typo3 v6.1来创建"text"类型的标准页面。在该视图中,Typo3 在富文本编辑器上创建的内容之前和之后添加了四个空段落。
<p class="bodytext"> </p>
<p class="bodytext"> <!-- CONTENT ELEMENT, uid:17/text [begin] --></p>
<p class="bodytext"> <a id="c17"></a></p>
<p class="bodytext"> <!-- Text: [begin] --></p>
<p class="bodytext">The actual text added using the Rich Text Editor</p>
<p class="bodytext"> <!-- Text: [end] --></p>
<p class="bodytext"> </p>
<p class="bodytext"> <!-- CONTENT ELEMENT, uid:17/text [end] --></p>
<p class="bodytext"> </p>
不用说,我想摆脱这种混乱,特别是因为
正在打破布局。
在错误的位置有一个parseFunc<lib.parseFunc_RTE。>
看起来你有类似的东西
page.10 = CONTENT
page.10.stdWrap.parseFunc < lib.parseFunc_RTE
这意味着:渲染内容,然后用lib.parseFunc_RTE解析此内容。激活包装的代码是
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.wrapNonWrappedLines = <p>|</p>
删除并不能解决此处的问题,因为原因是lib.parseFunc_RTE是在整个内容元素上处理的,而不仅仅是在应该定义它的正文文本上处理的。
看看你的错别字脚本或将其添加到你的问题中。
出于测试目的:
在顶层创建一个新站点,并仅添加基本的拼写脚本(添加css_styled_content模板;检查清除设置和常量)
page = PAGE
page.10 < styles.content.get
检查输出,内容不应再包装到p class="bodytext">中。
更新:
使用 {content},其中 {content} 通过 styles.content.get填充 parseFunc 执行两次。 styles.content.get 执行 parseFunc,因此可以将其输出到浏览器。但是f:format.html也执行了lib.parseFunc。所以,这就是为什么你的内容被解析两次。
# in this case, f:format.html does not need to execute the parseFunc again
<f:format.html parseFuncTSPath="">{content}</f:format.html>
如果您有RTE字段,请使用lib.parseFunc_RTE,如果您不希望字段中包含HTML代码(例如标头),请使用lib.parseFunc。
在根的模板脚本中添加以下行
在常量中:
content.RTE_compliant = 0
在设置中:
tt_content.stdWrap.dataWrap >
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines>
这是帖子中描述的问题变体的解决方案。
<f:format.html>
{field.copyrightText}
</f:format.html>
在预期段落之前和之后为您提供一个段落
<f:format.html>{field.copyrightText}</f:format.html>
不给你额外的段落。因此,模板中的中断似乎由格式视图助手解析
。希望这对某人有所帮助;祝你有美好的一天
我做了更多的研究,偶然发现了遇到同样问题的人。div
标签和注释是所谓的"CSS 样式内容"的结果。此内容使用content < styles.content.get
传递到前端,根据我的流体模板教程,这是将内容从 RTE 传递到模板的常用方法。
一个网站将这些描述为解决方案(或解决方法):
# standard enclosure for header
lib.stdheader.10.1.fontTag = <h1>|</h1>
# remove .csc-header
lib.stdheader.stdWrap.dataWrap >
# plain headings
lib.stdheader.2.headerStyle >
lib.stdheader.3.headerClass >
# (unknown, german version read "remove other stuff"
tt_content.stdWrap.dataWrap =
# disable .bodytext in RTE paragraphs
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class >
# disable paragraph-enclosure for these tags
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.encapsTagList = cite, div, p, pre, hr, h1, h2, h3, h4, h5, h6,table,tr,td
# remove paragraphs in tables
#lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.removeTags = p
# allow classes in tables
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.list >
警告:我不能说这个解决方法的质量。它确实解决了大多数问题(div,注释和类被删除),但p
标签仍然存在。
可以通过删除格式内的换行符/空格来更正.html标签
不對:
<f:format.html>{data_item.tx_mask_content_rte}
</f:format.html>
正确<f:format.html>{data_item.tx_mask_content_rte}</f:format.html>
这同样适用于<f:format.date>
,其中有换行符/空格会导致致命错误。
再次被流体恕我直言处理得很差。
希望对你有帮助
我也有这个问题,有时使用此设置会有所帮助:
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines>
但是我无法在表格中使用
。所以我在里面跳了一下,发现了这种可能性:
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.innerStdWrap_all.ifBlank =
这是为我所做的工作,我在设置中添加了以下行。
config.disablePrefixComment = 1
请将此代码添加到正文标签的末尾,
<script> var elems = document.getElementsByTagName('p'); var elemsLenght = elems.length; for (var i = 0; i < elemsLenght; ++i) { if (elems[i].innerHTML == '' || elems[i].innerHTML == ' ' || >elems[i].innerHTML == ' ') { elems[i].innerHTML=""; elems[i].className=""; } } </script>