tt_news

1.7.5. Registers

Registers can be considered as a clipboard which is in this case used to traverse values from the tt_news class to the TypoScript setup.

 

Name:

Description:

newsMoreLink

This register is filled with the html-string for the more-link

example:

  <a href="single/article/roeta-aula-dum/">more</a> 

newsCategoryUid

This register holds the Uid of the category of the current news record. if there is more than on category assigned, the uid of that one is choosen that is first in the list of categories of the news record.

newsKeywords

This register is filled with the value of the field "Keywords".

newsSubheader

This register is filled with the value of the field "Subheader" (short).

 

Alternative "more"-Link

If you want the "more"-link to appear inside the wrap of the subheader, you can use the stdWrap-function "append" to wrap the content of the register "newsMoreLink" to the subheader. Now the "more"-link should appear in the same line (and the same <p> tag) as the subheader.  

Example:

  plugin.tt_news.displayList.subheader_stdWrap { 
    append = TEXT 
    append.data = register:newsMoreLink 
    append.wrap = <span class="myclass">|</span> 
  } 
Conditional "more"-Link

With one more line of Typoscript the alternative "more" link can be made conditional – means: it will show up when the field "bodytext" contains something.

Example:

  plugin.tt_news.displayList.subheader_stdWrap { 
    append = TEXT 
    append.data = register:newsMoreLink 
    append.wrap = <span class="myclass">|</span> 
    append.if.isTrue.field = bodytext 
  } 
Different wraps by category

A register named "newsCategoryUid" is filled from the script with the uid of the first assigned category. You can access this register by TS to generate different wraps for different categories.

Example:

  plugin.tt_news.displayList {  
   title_stdWrap.wrap = <div class="news-list-title-{register:newsCategoryUid}">|</div> 
   title_stdWrap.insertData=1 
  }

You need a css-class for each category that contains the uid of the category in its name. for example:

  .news-list-title-4 { background-color: #090;} 
Adding dynamic Metatags in SINGLE view

The registers "newsKeywords" and "newsSubheader" can be used to fill values from the news record to the <meta> tags of the page with the SINGLE view on it. They are not filled in LIST and LATEST view.

Example:

This example assumes, that you've installed the extension "Meta tags extended" (extKey: metatags). The output of the extension is added to the "page" object as "headerData.999" (extension default).

  page.headerData.999 { 
  local > 
    local { 
      description.data = register:newsSubheader 
      keywords.data = register:newsKeywords 
    } 
  } 

 

To top


Valid XHTML 1.0!