Monday, November 30, 2015

Typoscript code to display content of this page - if empty fetch from specific page of TYPO3.

We'll fetch content from current page and check if this is empty we'll fetch content from page id = 38.
In the example below  `myContent` is fetching our default content. If this is empty we'll show content by `myContentBackup`  and this way we can go on ...

lib.myContent = CONTENT
 lib.myContent < styles.content.getLeft
 lib.myContent.stdWrap.ifEmpty.cObject < lib.myContentBackup
 lib.myContentBackup = CONTENT
 lib.myContentBackup {
    table = tt_content
        select {
            # specify the page id
            pidInList = 38
            # specify the column to fetch
            where = colPos = 3
            #for latest version language field is not required
            languageField = sys_language_uid
        }
}

No comments:

Post a Comment