typo3tt-news

tt_news single view with static news_id


I am using Typo3 Version 6.2 with the plugin tt_news.

All I want to do is:

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?


Solution

  • 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