简体   繁体   中英

TYPO3 - tx_news: Get detail view data of current visible news article outside of news templats

I would like to access to the Data (Specially the Media data) of the current visible news item outside of the news template. For example in the page template itself.

I hoped to find a ViewHelper in the news extension but there is no.

Currently I only see a way to do it like this somehow:

https://docs.typo3.org/typo3cms/extensions/news/AdministratorManual/BestPractice/IntegrationWithTypoScript/Index.html#plain-typoscript

Read the data via TypoScript and put it in a lib variable and then read it in the fluid template.

Did someone have an alternative, easier way?

I think that For this you are need use TypoScript together with ViewHelper

For example:

lib.tx_news.detail {
   ....something 
}

<f:cObject typoscriptObjectPath="lib.tx_news.detail"/>

It sounds like you want a very special view to your news record. That could be done with a second news plugin as a detail view on your page. As you do not want the text from the default detail view you can build a special layout so you only get the media data.
A plugin can be inserted as a content element in a special column or by typoscript.

Another way would be to do the queries on your own:
Either in typoscript (as a CONTENT object) or in PHP (as a viewhelper):
Identify the currently shown news by the URL parameter, then select all media related to that record.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM