Search code examples
typo3tx-news

tx_news: link to pdf in list view


I'm tyring to set up list view with tx_news and want to link a pdf file, that is also used as thumbnail directly in list view, not in detail view. Tried

<a href="{relatedFile.originalResource.publicUrl -> f:format.htmlspecialchars()}" target="_blank">

But the link remains empty... Any suggestions?


Solution

  • The snippet as is looks ok, maybe the the loop around this link might not be in Order.

    It should have structure like this:

    <f:for each="{news}" as="newsItem">
        <f:if condition="{newsItem.falMedia}">
            <f:then>
                <f:for each="{newsItem.falRelatedFiles}" as="falfile" iteration="i">
                    <li>
                        <span class="news-related-files-link">
                            <a href="{falfile.originalResource.publicUrl -> f:format.htmlspecialchars()}" target="_blank">
                                {falfile.originalResource.title}
                            </a>
                        </span>
                        <span class="news-related-files-size">
                            {falfile.originalResource.size -> f:format.bytes()}
                        </span>
                        <f:format.html>
                            falimage.uid     : {falimage.uid}
                            identifier       : {falimage.originalResource.identifier}
                            public_url       : {falimage.originalResource.publicUrl}
                            name             : {falimage.originalResource.name}
                            title            : {falimage.originalResource.title}
                            alternative      : {falimage.originalResource.alternative}
                            description      : {falimage.originalResource.description}
                            extension        : {falimage.originalResource.extension}
                            type             : {falimage.originalResource.type}
                            mimeType         : {falimage.originalResource.mimeType}
                            size             : {falimage.originalResource.size}
                            creationTime     : {falimage.originalResource.creationTime}
                            modificationTime : {falimage.originalResource.modificationTime}
                        </f:format.html>
                    </li>
                </f:for>
            </f:then>
            <f:else>
            </f:else>
        </f:if>
    </f:for>