1
votes

I am using Typo3 Version 6.2 with the plugin tt_news.

All I want to do is:

  • Have a simple page on my website
  • On that page I want to have a tt_news single view
  • the news_id of this view should be static (set by me) and NOT by GET variables

Use Case:

We have a company with many departments. For every department we have a couple of subpages on our website. Now I want to add specific news to each of those department websites. Like: On the team management page I want to show the news with ID = XY.

Is there any way to get this working?

1
You can use list view plugin. Limit just 1 item in list. Show full text of item in list and show item from specific category. One item - one category and just one item in list plugin tt_news) - Oleg V Karun
Could you switch to the News system extension? It's based on Extbase and Fluid and does have this feature right away. You can even migrate from tt_news. - insertusernamehere
@OlegVKarun But can I specify the news element within the specific category? Or will it only select the latest oder oldest element of this category? - zarathustra
@zarathustra I meen just one category for one item. And this way you can specify. But this very craftily. It is beter to use solution from the answer below - Oleg V Karun

1 Answers

2
votes

Insert the following lines to the setup field of an ext-template at the page where you want to display the selected news item in SINGLE view if no SINGLE view for another record was requested:

# hide the "no news id" message
plugin.tt_news._LOCAL_LANG.default.noNewsIdMsg =  
# set the tt_news singlePid to the current page
plugin.tt_news.singlePid = 977

# fill the content of the main-column to a tmp.object
tmp.pagecontent < page.10.subparts.contentarea

# clear the content of the main column
page.10.subparts.contentarea >

# build a new object for this column as content-object-array
page.10.subparts.contentarea = COA
page.10.subparts.contentarea {
  10 = CONTENT
  10.table = tt_news
  10.select {
# insert the pids of all pages from where you want to fetch news.
# the recursive-field has no influence on this selection
    pidInList = 25 # your pid
    # orderBy = datetime desc
    max = 1
   # get element with news id 10 @zarathustra
   where = tt_news.uid=10
  }
# insert the object “10.” only if there is no SINGLE news selected
  10.stdWrap.if.isFalse.data = GPvar:tx_ttnews|tt_news
# re-insert the normal pagecontent to the page
  20 < tmp.pagecontent
}

More information here http://docs.typo3.org/typo3cms/extensions/tt_news/3.5.1/ExtNews/Configuration/TyposcriptExamples/Index.html#default-news-id