typo3 7: add new tt_content layout and make it look differently

I am working with version 7 for the first time and for a special page I had to change tt_content a little. I needed textmedia to have a new layout option and – if selected – the layout should look a little different. So I added the new layout:

TCEFORM.tt_content.layout.addItems.10 = Layout Specialpage

Now I fetched the following 2 pages from the typo3 source: sysext/fluid_styled_content/Resources/Private/Templates/Textmedia.html and sysext/fluid_styled_content/Resources/Private/Partials/MediaGallery.html. I copied these in my extbase extension to the folder extensionname/Resources/Private/Templates/Content/Textmedia.html and extensionname/Resources/Private/Templates/Content/Partials/Textmedia.html

This doesn’t have to be an extension folder, it can also be copied into a fileadmin folder, because in my setup I have to define the paths anyway:

lib.fluidContent {
	templateRootPaths.10 = EXT:extensionname/Resources/Private/Templates/Content/
	partialRootPaths.10 = EXT:extensionname/Resources/Private/Templates/Content/Partials/

And it works! My textmedia.html looks roughly like this:

<div class="layout-{data.layout}" id="c{data.uid}">
  <f:if condition="{data.layout} == 10"> 
      <div class="row">
        <div class="col-xs-12 col-sm-6"><f:render arguments="{_all}" partial="MediaGallery"></f:render></div>
        <div class="col-xs-12 col-sm-6"><f:format.html>{data.bodytext}</f:format.html></div>
    <f:else> .... </f:else> 

And in MediaGallery.html I have access to {data.layout} as well, so I can modify that as I see fit.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.