Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typo3 第三,新闻。如何定义新的列表视图?_Typo3 - Fatal编程技术网

Typo3 第三,新闻。如何定义新的列表视图?

Typo3 第三,新闻。如何定义新的列表视图?,typo3,Typo3,我需要一个新闻速成班(和一些打字错误)。我想有一个进一步的“显示什么”插件选项,以显示自定义的新闻列表 我(相信)了解如何在newsController类中定义新的mylistAction方法,以及相应的mylist.html模板 我错过的是如何在BE模块中获得一个(工作)mylist选项以将插件插入页面。 我不确定我还需要更新什么以及如何更新(TCA、语言文件、TS等) 谢谢你的帮助,干杯,马里奥 -----编辑和解决 我成功了 我在newcontroller.php 我定义了模板listm

我需要一个新闻速成班(和一些打字错误)。我想有一个进一步的“显示什么”插件选项,以显示自定义的新闻列表

我(相信)了解如何在newsController类中定义新的mylistAction方法,以及相应的mylist.html模板

我错过的是如何在BE模块中获得一个(工作)mylist选项以将插件插入页面。 我不确定我还需要更新什么以及如何更新(TCA、语言文件、TS等)

谢谢你的帮助,干杯,马里奥

-----编辑解决 我成功了

  • 我在
    newcontroller.php
  • 我定义了模板
    listm.html
  • Configuration/Flexforms/flexform_news.xml
    中,我添加了行:

    <numIndex index="22"> <numIndex index="0">LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_general.mode.news_listm </numIndex> <numIndex index="1">News->listm</numIndex> </numIndex>
现在我可以在带有

新建listm选项,并呈现listm模板。(看来我也需要清理缓存)。好!

如果要将插件插入页面,需要为其创建自定义前端插件。差不多

ext\u tables.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'Namespace.' . $_EXTKEY,
    'custom_news',
    'Custom News'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Namespace.' . $_EXTKEY,
    'custom_news',
    array('CustomNews' => 'mylist'),
    // non-cacheable actions
    array('CustomNews' => 'mylist')
);
ext\u localconf.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'Namespace.' . $_EXTKEY,
    'custom_news',
    'Custom News'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Namespace.' . $_EXTKEY,
    'custom_news',
    array('CustomNews' => 'mylist'),
    // non-cacheable actions
    array('CustomNews' => 'mylist')
);
我希望您为它创建了自定义扩展和扩展的newsController


您好,安东,修改新闻分机是个坏主意-您不能在事后真正更新它

但是,EXT:news有一种内置的方式来添加多个列表视图

简短版本:新闻插件中有一个模板选择器,您可以通过打字脚本向其添加项目。在您的页面中放入类似的内容:

tx_news.templateLayouts {
    1 = A custom layout
    99 = LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_general.mode.news_listm
}
您在后端在此字段中所做的选择将传递到变量
settings.templateLayout
中的视图

因此,在
List.html
模板文件中,您可以执行以下操作:

<f:if condition="{settings.templateLayout} == 99">
    <f:then>
        <!-- Render template with number 99 here -->
    </f:then>
    <f:else>
        <!-- Render template with number 1 here -->
    </f:else>
</f:if>


如果您有多个模板,最好使用或类似的模板。

谢谢。如果我想要一个新的自我定位呢?有类似的把戏吗?