typo3fluidtx-newstypo3-10.x

how to show the sys_category image in the news category list view


I'm using the news extensions with the sys_category on TYPO3 v10.

I show a list the categories like this:
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>

but this show the error :
Oops, an error occurred! You must either specify a string src or a File object.


Solution

  • The solution is to change the image call to:

    <f:image image="{category.item.images.0}" />