1

I have a multilingual language (One-Tree-Solution) with the languages German (default) and English. The news are in German and English. The website also has a newsletter page. The newsletter (Extension newsletter) is written on the German page. Now I want to add automatically the last 3 news to this newsletter. I use the following code, which works fine:

lib.news = USER
lib.news {
 userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
 extensionName = News
 pluginName = Pi1
 vendorName = GeorgRinger

 switchableControllerActions {
    News {
      1 = list
    }
}

 settings < plugin.tx_news.settings
 settings {
    cropMaxCharacters = 300
    limit = 3
    detailPid = 50
    overrideFlexformSettingsIfEmpty := addToList(detailPid)
    startingpoint = 51
 }
}

This gives me a list of the news in the default language. How can I add an additional list of the news in the second language as well?

Ralf
  • 65
  • 10

3 Answers3

1

depending on your configuration two solutions come to mind:

  1. use different folders for each language
    if you have no strict translation for the news, you can store the news depending on language in different folders. then the language of news can be selected in the plugin by selecting different storage pages

  2. use a help-page
    you can build another page where you show only the news (like for an AJAX request). in your newsletter (page) you include this page twice: once with ?L=0 and once with ?L=1

Bernd Wilke πφ
  • 10,390
  • 1
  • 19
  • 38
0

The only solution i see there is to extend the news plugin. There you can find more resources http://www.lukasjakob.com/extend-a-typo3-extbase-model-with-custom-field/

Andrei Todorut
  • 4,260
  • 2
  • 17
  • 28
0

Thank you Bernd and Andrei for your suggestions. I now found another solution and inserted the news by pure typoscript. This is the code, which works for me:

lib.newsblock = CONTENT
lib.newsblock.wrap = <div class="news"><h2">Letzte Artikel.</h2>|</div>
lib.newsblock {
table = tx_news_domain_model_news
select {
pidInList = {$global.news.pid}
# disable default language selection
languageField = 0
max = 3
where = deleted = 0 and hidden = 0 AND sys_language_uid = 0
orderBy = datetime DESC
}

renderObj = COA   
renderObj {  

10 = TEXT
10.field = title
10.wrap = <h2></h2>

# get news image
20 = FILES
20 {
 references {
  table = tx_news_domain_model_news
  uid.field = uid
  fieldName = fal_media
 }

 begin = 0
 maxItems = 1
 renderObj = IMAGE  
 renderObj.params = class="left" align="left"    
 renderObj {
   wrap = <p>|</p>
   file.import.data =file:current:publicUrl
   file.width = 120c
   file.height = 120c
  }    
}
30 = COA
30.wrap = <div>|</div>
30.10 = TEXT
30.10.field = teaser
30.10.wrap = <p>|</p>
30.20 = TEXT
30.20.value =  &gt; Weiterlesen
30.20.typolink {
parameter = {$global.news.single}
additionalParams.data = field:uid
additionalParams.wrap = &tx_news_pi1[controller]=News&tx_news_pi1[action]=detail&tx_news_pi1[news]=|
useCacheHash = 1
}
30.20.typolink.title.field = title
30.20.wrap = <p>|</p>  
}     
}

lib.news = COA
# default language German
lib.news.10 < lib.newsblock

# English
lib.news.20 < lib.newsblock
lib.news.20.wrap = <div class="news"><h2>Recent articles.</h2>|</div>
lib.news.20.select.where = deleted = 0 and hidden = 0 AND sys_language_uid = 1
lib.news.20.renderObj.30.20.value =  &gt; Read more
lib.news.20.renderObj.30.20.typolink.additionalParams.wrap = &tx_news_pi1[controller]=News&tx_news_pi1[action]=detail&tx_news_pi1[news]=|&L=1
Ralf
  • 65
  • 10