如何在新闻类别列表视图中显示 sys_category 图像
how to show the sys_category image in the news category list view
我在 TYPO3 v10 上使用带有 sys_category 的新闻扩展。
我显示了这样一个类别列表:
typo3conf\ext\news\Resources\Private\Templates\Category\List.html
<ul>
<f:for each="{categories}" as="category">
<li>
<f:if condition="{category.item.uid} == {overwriteDemand.categories}">
<f:then>
<f:link.page title="{category.item.title}" class="active" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:then>
<f:else>
<div class="image-categ">
<f:image image="{category.originalResource.originalFile}" />
</div>
<f:link.page title="{category.item.title}" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:else>
</f:if>
<f:if condition="{category.children}">
<f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand}" />
</f:if>
</li>
</f:for>
</ul>
但这显示错误:
Oops, an error occurred! You must either specify a string src or a File object.
解决方法是将图像调用更改为:
<f:image image="{category.item.images.0}" />
我在 TYPO3 v10 上使用带有 sys_category 的新闻扩展。
我显示了这样一个类别列表:
typo3conf\ext\news\Resources\Private\Templates\Category\List.html
<ul>
<f:for each="{categories}" as="category">
<li>
<f:if condition="{category.item.uid} == {overwriteDemand.categories}">
<f:then>
<f:link.page title="{category.item.title}" class="active" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:then>
<f:else>
<div class="image-categ">
<f:image image="{category.originalResource.originalFile}" />
</div>
<f:link.page title="{category.item.title}" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:else>
</f:if>
<f:if condition="{category.children}">
<f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand}" />
</f:if>
</li>
</f:for>
</ul>
但这显示错误:
Oops, an error occurred! You must either specify a string src or a File object.
解决方法是将图像调用更改为:
<f:image image="{category.item.images.0}" />