我明白外的開箱,我們可以循環或迭代陣列在DWT模板構建模塊(TBBS)具有以下。什麼可以在DWT(佈局)模板構建塊中循環?
<!-- TemplateBeginRepeat name="array_name" -->
<!-- template logic -->
<!-- TemplateEndRepeat -->
的documentation describes pre-defined package items以及how to use them。
綜上所述,我們可以使用:
Component
引用當前組件遍歷組件或組件演示時ComponentTemplate
引用當前組件模板在組件演示迭代時(這將是在頁面電平)Field
遍歷字段以及多值字段時,參考電流場。FieldPath
獲取迭代項目的完整路徑。當在嵌套循環中使用TemplateRepeatIndex
時很有用,如The Tridion Practice Cookbook所示。*TemplateRepeatIndex
,基於零的循環計數。
我們可以做Fields
嵌套循環在組件陣列循環中給定的組件,以及通過遍歷多值字段時,有條件地檢查特定的字段名。
我看過雙查找嵌套DWT的語法(例如@@Image_${TemplateRepeatIndex}@@
as described on Yet Another Tridion Blog)。
問題(S)
可以肯定,這些都是項目或數組/集合一個複合模板的Package
,右(或者有默認或通過我們的代碼放置)?
我們可不可以「迭代」在包中的單獨項目?
例如,如果我們在Package
中有單獨的組件,我們可以使用類似@@Component${TemplateRepeatIndex}@@
的東西來「遍歷」它們嗎?
- 的Component1
- COMPONENT2
- Component3
我看看我能參考我見過一個循環內這樣的項目,但一切都表明,以下是不可能的:
<!-- TemplateBeginRepeat name="@@Component${TemplateRepeatIndex}@@" -->
<!-- do something with @@Component${TemplateRepeatIndex}@@ -->
<!-- TemplateEndRepeat -->
感謝巴特,我已經看到了這個問題的最近變化,並想知道我們能以某種方式「拯救」伯爵無論從任何創建包變量。好東西。 –