2015-07-20 73 views

回答

0

你的問題實在是不明確的,但如果你想每一個圖像(例如,在「文本和照片」的內容元素)與包含頁面的類別中的類屬性的div中被包裹,可以使用下面的代碼。請確保您更改「pidInList」的價值!

tt_content.image.20.1.stdWrap.prepend = COA 
tt_content.image.20.1.stdWrap.prepend { 
    10 = TEXT 
    10.value = <div class=" 
    20 = CONTENT 
    20 { 
    table = sys_category 
    select { 
# -------------------------------------------------------------------- 
# --- enter the uid of the page containing your categories here 
     pidInList = 123 
# -------------------------------------------------------------------- 
     selectFields = sys_category.title AS cattitle 
     join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid 
# -------------------------------------------------------------------- 
# --- use pid here if you want the categories of the page 
# --- use uid here if you want the categories of the content element 
     where.field = pid 
# -------------------------------------------------------------------- 
     where.intval = 1 
     where.wrap = sys_category_record_mm.uid_foreign=| 
     orderBy = sys_category_record_mm.sorting_foreign 
     languageField = sys_category.sys_language_uid 
    } 
    renderObj = TEXT 
    renderObj { 
     field = cattitle 
     noTrimWrap = || | 
    } 
    stdWrap.ifEmpty.cObject = TEXT 
    stdWrap.ifEmpty.cObject.value = no-categories 
    } 
    40 = TEXT 
    40.value = "> 
} 
tt_content.image.20.1.stdWrap.append = TEXT 
tt_content.image.20.1.stdWrap.append.value = </div> 

如果頁面類別CAT1和CAT2檢查和的類別被存儲在頁與UID 123,此代碼應導致<div class="cat1 cat2 "><img ...></div>用於在「文本和照片」或「圖片」內容元素的每個圖像。