2016-12-05 81 views
-1

我嘗試爲當前頁面創建第二個後備選項。 我的當前函數獲取父頁面的內容,如果我的列是空的。但是如果我的回退也是空的,我還需要一個選項。 它應該進入下一級(leveluid:-3),如果我的回退也應該是空的。第二個if空條件

有沒有解決方案來處理與typoscript這個問題?

variables.element = CONTENT 
variables.element { 
    table = tt_content 
    select { 
    pidInList.data = page:uid 
    orderBy = sorting 
    where = colPos=3 
    } 
    # Fallback 
    stdWrap.ifEmpty.cObject = CONTENT 
    stdWrap.ifEmpty.cObject { 
    table = tt_content 
    select { 
     pidInList.data = leveluid:-2 
     orderBy = sorting 
     where = colPos=3 
    } 
    } 
    # Fallback 2 
    stdWrap.ifEmpty.cObject = CONTENT 
    stdWrap.ifEmpty.cObject { 
    table = tt_content 
    select { 
     pidInList.data = leveluid:-3 
     orderBy = sorting 
     where = colPos=3 
    } 
    } 
} 

回答

4

你爲什麼這麼做很複雜?

使用CSC或FSC定義styles.content.get來收集主列中的內容記錄(colPos = 0)。

這是很容易提升到其他列,有一個簡單的機制,從上面的網頁收集內容:slide(請參閱內容的文檔)

variables.element < styles.content.get 
variables.element.select.where = colPos = 3 
variables.element.slide = -1