我試圖通過在頁面的typoscript呈現菜單中出現的頁數來分割一個數字(由於使用Foundation的前端框架,我的情況是12),並輸出結果作爲html菜單項的類名的一部分。Typoscript的數學運算
目前,我可以得到typoscript輸出菜單中的項數{register:count_menuItems}
,但我無法弄清楚如何分割這個數字並輸出商。
下面是我的代碼:
lib.navigation.secondary = HMENU
lib.navigation.secondary {
entryLevel = 1
stdWrap.dataWrap = <div class="row large-10 small-centered large-centered columns">|</div>
1 = TMENU
1 {
NO {
allWrap = <div class="large-{register:count_menuItems} small-12 columns first">|</div> |*| <div class="large-{register:count_menuItems} small-12 columns">|</div> |*| <div class="large-{register:count_menuItems} small-12 columns last">|</div>
allWrap.insertData = 1
stdWrap.cObject = COA
stdWrap.cObject {
# getting the navigation title with fallback to the title
10 = TEXT
10.field = nav_title // title
10.wrap = <h4>|</h4>
# getting the subtitle of the page
20 = TEXT
20.field = subtitle
20.wrap = <p>|</p>
}
}
}
}
要創建儘管這樣的工作對我來說,我很想看到更簡潔的實現! –