2015

2015-3 Render FAL images from content elements and give them different css-Classes

by Sacha Vorbeck, 2015-11-03 14:03:02, old #482, typoscript

Description:
This snippets is designed to render one or multiple logos or headlines in the header section of a website. Editors can add the logos by creating content elements of type image/media in a certain page/folder. If they create a content elment of type TEXT, a headline will be added instead of a logo. One special requirement was that the first logo should be aligned left and the other logos right, so all logos after the first one must have an additional CSS-Class. As the params property of the IMAGE object doesn`t support optionSplit (which proably wouldn`t have worked anyway inside the render-Object), I used the optionSplit replace function.
Code:
lib.logo = COA
lib.logo {
   10 < styles.content.get
   10 {
      select.pidInList = {$portal.pid.logos}
      renderObj = COA
      renderObj {
         10 = CASE
         10 {
            key.field = CType
            image = COA
            image {
               10 = FILES
               10 {
                  references {
                     table = tt_content
                     uid.field = uid
                     fieldName = image
                  }
                  renderObj = IMAGE
                  renderObj {
                     file.import.data = file:current:publicUrl
                     altText.data = file:current:alternative
                     params = css_class
                  }
               }
            }
            text = TEXT
            text {
               field = header
               wrap = <span class="logoHeadline">|</span>
            }
         }
      }
      stdWrap {
         replacement {
            10 {
               search = css_class
               replace =  || class="right" |*| class="right"
               useOptionSplitReplace = 1
            }
         }
      }
   }
   stdWrap {
      wrap = <h1 class="clearfix">|</h1>
      typolink {
         parameter = {$portal.pid.root}
         addQueryString = 1
         ATagParams = class="startLink"
      }
   }
}

2015-2 Onepage configuration

by Lars Messmer - comsolit AG, 2015-10-16 17:23:28, old #481, typoscript

Keywords:
page
Description:
Example TypoScript for Onepage Website with TYPO3 based on pages
Code:
lib.onePage = CONTENT
lib.onePage {
   table = pages
   select.orderBy = sorting

   renderObj = COA
   renderObj {

      10 = TEXT
      10.value = <section id="{field:subtitle}">
      10.insertData = 1

      100 = CONTENT
      100 {
         table = tt_content
         select {
            pidInList.field = uid
            orderBy = sorting
            where = colPos = 0
         }
         wrap = <div class="content">|</div>
         wrap.insertData = 1
      }

      999 = TEXT
      999.value = </section>
   }
}