【问题标题】:TYPO3 rte didn't render <p> tag in extension output viewTYPO3 rte 未在扩展输出视图中呈现 <p> 标记
【发布时间】:2013-10-29 12:26:02
【问题描述】:

我的扩展程序中的rte 有一些问题。在表格中,我设置了字段text area with rte。在 BE TYPO3 生成 rte 视图中,当我格式化文本时,一切正常。唯一的问题是当我有一些段落时 - 在 BE 我有 &lt;p&gt; 标签,但在 HTML 代码的前端,&lt;p&gt; 标签不“存在”。

我的 TCA 代码如下所示:

'description' => array(     
        'exclude' => 1,     
        'label' => 'LLL:EXT:fu_product_table/locallang_db.xml:tx_table_products.description',       
        'defaultExtras' => 'richtext[*]',
        'config' => array(
            'type' => 'text',
            'cols' => '30',
            'rows' => '5',
            'wizards' => array(
                '_PADDING' => 2,
                'RTE' => array(
                    'notNewRecords' => 1,
                    'RTEonly'       => 1,
                    'type'          => 'script',
                    'title'         => 'Full screen Rich Text Editing|Formatteret redigering i hele vinduet',
                    'icon'          => 'wizard_rte2.gif',
                    'script'        => 'wizard_rte.php',
                ),
            ),
        )
      ),

然后尝试在类中渲染字段:

'<td class="td-1">' . $this->getFieldContent('description') . '</td>';

有什么建议吗?

【问题讨论】:

  • 如何在前端显示字段?
  • &lt;td class="td-1" &gt;' . $this-&gt;getFieldContent('description') . '&lt;/td&gt;,但会显示其他标签,例如 &lt;br /&gt;
  • 请检查这个:$this-&gt;pi_RTEcssText($this-&gt;getFieldContent('description'))
  • 像魅力一样工作:)

标签: php typo3


【解决方案1】:

TYPO3 将 RTE 的内容稍微“修剪”(没有完整标记)保存,因此要将其“还原”回有效的 HTML,您需要使用专用方法将其包装,即:

$this->pi_RTEcssText($this->getFieldContent('description'))

注意:Adrian,Extbase 的下一点:它有专门的 viewhelper,所以你可以直接在模板中轻松完成;)

【讨论】:

  • 我正在尝试从 extbase 和流体开始。是否有类似 Kickstarter 的 extbase 技术?
  • 当然:typo3.org/extensions/repository/view/extension_builder - 重要的是为 TYPO3 v. 4 选择 2.4.7 或为 TYPO3 v. 6+ 选择 2.5.0+
  • 感谢 Biesior 提供信息 - 如果我有空闲时间我会尝试
猜你喜欢
  • 2016-11-16
  • 2019-07-31
  • 1970-01-01
  • 1970-01-01
  • 2019-03-31
  • 2014-07-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多