Search code examples
typo3typoscripttt-news

tt_news: use news title as download title in list view


My news should not contain any text, except for the title. Instead, in the list view the title should directly point to the first attached file (a PDF).

Now I thought the simplest solution for that would be to hide the title, show only the attached files and give them the title of the related news entry via TypoScript.

For the detail view this code works fine:

plugin.tt_news.newsFiles {
    labelStdWrap.cObject = TEXT
    labelStdWrap.cObject.dataWrap = DB:tt_news:{GPvar:tx_ttnews|tt_news}:title
    labelStdWrap.cObject.wrap3 = {|}
    labelStdWrap.cObject.insertData = 1
}

...but it uses the GPvar for the currently displayed news, which of course is not present in list view.

So my question is: how do I get the ID of the currently iterated news entry, if possible at all?

I am open to other solutions as well.


Solution

  • You will need to use custom itemMarkerArrayFunc - fastest by copying the sample into your own extension: typo3conf/ext/tt_news/res/example_itemMarkerArrayFunc.php and adding custom marker to $markerArray.

    The mentioned sample even demonstrates access to files so I assume that should not be a problem to modify it for your needs.

    Note: if you haven't any own ext to copy the func into it, and you don't want to create such, try to copy it somewhere under fileadmin folder, modifying files in original destination is wrong idea, cause you'll lost all changes after next tt_news' update.