2

我正在尝试创建一个与 TYPO3兼容的 jQueryMobile <table>

这意味着添加data-role="table"class="class="ui-responsive""

此表可以使用 RTE 或表内容元素生成。

即时通讯

默认<table>HTML

<table style="" class="contenttable">
    <thead>
        <tr>
            <th scope="col">head 1</th>
            <th scope="col">head 2</th>
            <th scope="col">head 3</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>L 1</td>
            <td>...</td>
            <td>...</td>
        </tr>
        <tr>
            <td>L 2</td>
            <td>...</td>
            <td>...</td>
        </tr>
    </tbody>
</table>

试图解决问题

我添加了以下设置,但 jQuery 接缝不再起作用。它无限期地加载(旋转动画)。

lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.data-role.always = 1
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.data-role.default = table

lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.default = ui-responsive
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.list = ui-responsive

内容元素

默认<table>HTML

<table class="contenttable contenttable-0 test">
    <thead>
        <tr class="tr-even tr-0">
             <th class="td-0" scope="col" id="col162967-0">head 1</th>
             <th class="td-1" scope="col" id="col162967-1">head 2</th>
             <th class="td-last td-2" scope="col" id="col162967-2">head 3</th>
         </tr>
     </thead>
     <tbody>
         <tr class="tr-odd tr-1">
             <td class="td-0" headers="col162967-0">L 1</td>
             <td class="td-1" headers="col162967-1">...</td>
             <td class="td-last td-2" headers="col162967-2">...</td>
         </tr>
         <tr class="tr-even tr-last">
             <td class="td-0" headers="col162967-0">L 2</td>
             <td class="td-1" headers="col162967-1">...</td>
             <td class="td-last td-2" headers="col162967-2">...</td>
         </tr>
    </tbody>
</table>

试图解决问题

我找不到在tt_content哪里添加配置以添加classdata-role.


对于 TABLE 内容元素,您至少有 2 个选项:

A. 自己渲染表格- 您可以创建自己的 PHP 方法来处理表格。我假设您正在使用css_styled_content扩展,其方法render_table()会渲染表格。您可以复制该方法,将其添加到您自己的类中并对其进行修改,以便它根据需要添加data-role属性。

B. 对输出的代码进行一些替换- 您可以尝试使用replacement属性(在 TYPO3 >=4.6 中可用)stdWrapclass="contenttable替换为data-role="table" class="ui-responsive。我目前无法测试它,但试试这个:

tt_content.table.20.stdWrap.replacement {
  10 {
    search = class="contenttable
    replace = data-role="table" class="ui-responsive
  }
}
4

2 回答 2

1

For the TABLE content element you have at least 2 options:

A. Render the table yourself - You can create your own PHP method that would do the processing of the tables. I presume you are using css_styled_content extension whose method render_table() does the rendering of the tables. You can copy that method, add it to your own class and modify it so that it adds the data-role attribute as you want.

B. Do some replacing of the outputted code - You can try to use the replacement property (available in TYPO3 >=4.6) of the stdWrap to replace class="contenttable with data-role="table" class="ui-responsive. I currently cannot test it but try this:

tt_content.table.20.stdWrap.replacement {
  10 {
    search = class="contenttable
    replace = data-role="table" class="ui-responsive
  }
}
于 2013-10-03T13:29:29.583 回答
0

在 forge 处打开了一个错误报告,以通过 TSconfig TYPO3 forge 覆盖 Flexform 值。

通过覆盖 flexform 建议的解决方法完全可以正常工作:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('*', 'FILE:EXT:'.$_EXTKEY.'/flexform_table.xml', 'table');
于 2014-02-03T21:29:04.867 回答