6

我正在使用 Typo3 v6.1 创建一个“文本”类型的标准页面。在视图中,Typo3 在富文本编辑器上创建的内容前后添加了四个空段落。

<p class="bodytext">&nbsp;</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">&nbsp;</p>
<p class="bodytext">    <!--  CONTENT ELEMENT, uid:17/text [end] --></p>
<p class="bodytext">&nbsp;</p>  

不用说,我想摆脱这种混乱,特别是因为它们&nbsp;正在破坏布局。

4

8 回答 8

8

有一个 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 是在整个内容元素上处理的,而不仅仅是在应该定义它的 bodytext 上。

查看您的 TypoScript 或将其添加到您的问题中。

用于测试目的:

在顶层创建一个新站点,并仅添加基本的 TypoScript(添加 css_styled_content 模板;检查清除设置和常量)

page = PAGE
page.10 < styles.content.get

检查该输出,内容不应再包装到p class="bodytext"中。

更新:

使用 {content} 其中 {content} 通过 styles.content.get fe 填充 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 代码(fe 标头),请使用 lib.parseFunc。

于 2013-12-19T07:49:17.470 回答
6

在根的模板脚本中添加以下行

在常量中:

content.RTE_compliant = 0

在设置中:

tt_content.stdWrap.dataWrap >
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines>
于 2014-02-12T09:11:22.710 回答
1

这是帖子中描述的问题的变体的解决方案。

<f:format.html>
   {field.copyrightText}
</f:format.html>

在预期段落之前和之后给你一个段落

<f:format.html>{field.copyrightText}</f:format.html>

没有额外的段落。所以模板中的中断似乎是由格式 viewHelper 解析的。

希望这对某人有所帮助;祝你有美好的一天

于 2017-09-18T15:27:30.757 回答
0

我做了更多的研究,偶然发现有人遇到同样的问题。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标签仍然存在。

于 2014-01-08T17:20:10.250 回答
0

我也有这个问题,有时它有助于使用这个设置:

lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines>

但它的情况是我无法
在表格中使用。所以我往里面跳了一下,发现了这种可能性:

lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.innerStdWrap_all.ifBlank =

于 2021-08-30T15:27:20.280 回答
0

可以通过删除 format.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>,其中有换行符/空格会导致致命错误。

流体恕我直言,再次处理不当。

希望能帮助到你

于 2018-01-04T09:01:45.773 回答
-1

这就是我的工作,我在我的设置中添加了以下行。

config.disablePrefixComment = 1
于 2013-12-22T14:09:16.263 回答
-5

请将此代码添加到正文标记的末尾上方,

<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 == '&nbsp;')
      { 
          elems[i].innerHTML="";
          elems[i].className="";
      }
    }
 </script>
于 2013-12-19T06:44:07.107 回答