[TYPO3-english] tt_news: list and singelview on same page - no news_id given?

Morten Kjems mortenkjems at gmail.com
Mon Jun 15 10:02:42 CEST 2009

Hi Rubert

> search for "Default news id" on this page:
> http://typo3.org/documentation/document-library/extension-manuals/tt_news/2.5.2/view/1/7/

I found a solution that work for Templa Voila.

The original idea come from Erik Svendsen.

Here is the trick:

First you create a simple FCE may mapping a div tag as a typoscript 
object path. You can call the object something like lib.singleview_fce

Then you insert the FCE instedt of the tt_news plugin that displays 

Now create an ext template on the page where you want both list and 
singel view to display.

In this template you build lib.singleview_fce to display tt_news 
singleview like this:

### Snippet begin ###

#Getting rid of no news ID given
plugin.tt_news._LOCAL_LANG.default.noNewsIdMsg =

#defining the single news element
lib.singleview_fce >
lib.singleview_fce < plugin.tt_news
lib.singleview_fce {
     code >
     code = SINGLE
     pid_list >
     pid_list = 44
     catImageMode = 0
     catTextMode = 0
     templateFile = fileadmin/templates/extension_templates/newslist.html

#The rest of the code is from the manual - Default news id -
#but with the TypoScriptObject lib.singleview_fce instead of page.10

#Same page as the TS/plugin is on
plugin.tt_news.singlePid = 44
plugin.tt_news.templateFile = 

tmp.pagecontent < lib.singleview_fce
lib.singleview_fce >

lib.singleview_fce = COA
lib.singleview_fce {
   10 = CONTENT
   10.table = tt_news
   10.select {
     pidInList = 44
     orderBy = datetime desc
     max = 1
   10.stdWrap.if.isFalse.data = GPvar:tx_ttnews|tt_news
   20 < tmp.pagecontent

### Snippet end ###

It works just fine. Maybe it was an idea to put this snippet in the 
manual so Templa Voila users have this option.

Best regards

More information about the TYPO3-english mailing list