Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

Content Rendering

From TYPO3Wiki
Jump to: navigation, search

How to render the last content element differently

This example shows how you can render the last content element on a page differently from all others.

  # First render all content elements but the last (10),
  # and then only the last (20).
  INHALT = COA
  INHALT {
    10 = COA
    # Render all content elements but the last one.
    10 {
      # Only execute this part (and render the content elements),
      # if MORE THAN ONE content element is to be displayed.
      if.value = 1
      # That's the case, if numRows
      # for the middle column (colPos=0)
      # returns more than one line as result.
      if.isGreaterThan.numRows {
        table = tt_content
        select.orderBy = sorting
        select.where = colPos=0
        select.languageField = sys_language_uid
      }

      1 = CONTENT
      1 {
        # The next 4 lines are a copy of styles.content.get
        table = tt_content
        select.orderBy = sorting
        select.where = colPos=0
        select.languageField = sys_language_uid

        # begin = 0 starts with the first content element.
        select.begin = 0

        # This leaves away the last CE.
        select.max = total - 1

        renderObj < tt_content
      }

    }

    # Render the last CE.
    20 < .10.1
    20.select.max >
    20.select.max = 1
    20.select.begin = total - 1
    # For the last content element, use an adjusted "Link to top".
    20.renderObj.stdWrap.innerWrap2 = |<div class="nach_oben"><a href="{TSFE:siteScript}#top">nach oben</a></div>
  }