Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To retrieve images from a new field in txnews using sysfile_reference, follow these steps:

  1. In the TYPO3 backend, go to the "List" module and select "News" from the dropdown menu.
  2. Click on the "Administration" tab and select "Table Configuration".
  3. In the "Fields" tab, add a new field of type "Inline" with the name of your choice, for example "news_image".
  4. Save the changes and reload the page.
  5. Now, when you create or edit a news item, you will see the new "news_image" field where you can upload an image.
  6. In your template or extension, use the following code to retrieve the image:
<f:for each="{newsItem.relatedFiles}" as="fileReference">
  <f:if condition="{fileReference.fieldname} == 'news_image'">
    <f:image image="{fileReference}" />
  </f:if>
</f:for>

This code loops through all the related files for the news item and checks if the fieldname matches "news_image". If it does, it displays the image using the f:image viewhelper.