.. ================================================== .. FOR YOUR INFORMATION .. -------------------------------------------------- .. -*- coding: utf-8 -*- with BOM. .. include:: ../../Includes.txt Custom Templates by using the Layout selector ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This entry should help you to use different templates for different (list) views. Using the following Page TsConfig the editor can select the layouts in the news plugin: :: tx_news.templateLayouts { 1 = A custom layout 99 = LLL:fileadmin/somelocallang/locallang.xlf:someTranslation } You can use any number to identify your layout and any label to describe it. Now it is possible to use a condition in the template to change the layouts, and e.g. load a different partial: ::
As you can see in this example a different partial is loaded if the layout 99 is used. Custom Templates by using TypoScript ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You can define a custom TypoScript setting which you can check in the view later on. The TypoScript could look like: :: plugin.tx_news { settings { isLatest = 1 } } And then you can use a condition like this: :: do something if it is set do something if it is not set Use current content element in the Template ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you ever need information from the content element itself, you can use: :: {contentObjectData.header} This will get you the header of the content element, but of course you can use any other field of tt_content too. Cycle through 3 css classes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sometimes it is useful to iterate over news items and use different classes for every news item. This examples shows how you can cycle through 3 css classes and repeat those. ::
  • position: {cycle} // newsUID: {newsItem.uid}
  • FLUID Condition for categories ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you want to create a condition based on a specific category, you can use something like this: :: do something if category is uid 1 It is of course also possible to write a custom ViewHelper. Change template of pagination ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you want to customize the Paginate ViewHelper Template you can customize it by following this example: :: plugin.tx_news { view { widget.Tx_News_ViewHelpers_Widget_PaginateViewHelper.templateRootPath = fileadmin/pathtocustomnews/Templates/ } } The template needs to be then saved in this place: :: fileadmin/pathtocustomnews/Templates/ViewHelpers/Widget/Paginate/Index.html **Attention:**: This works since TYPO3 4.6 (see http://forge.typo3.org/issues/10823)