Typo3:使用sys_category包装图像

时间:2015-07-20 08:37:15

标签: typo3 typoscript

我想用一个包含sys_category的css包装标准的typo3图像。

喜欢

String array[] = new String[headers.size()];

for (int j = 0; j < headers.size(); j++) {
    array[j] = headers.get(j).toString();
}

现在尝试几天没有成功: - (

1 个答案:

答案 0 :(得分:1)

您的问题确实不明确,但是如果您希望每个图像(例如在&#34;文本和图片&#34;内容元素中)都包含一个包含类属性中页面类别的div,您可以使用以下代码。确保更改&#34; pidInList&#34;!

的值
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的页面中,则此代码应为{&#34;文本和图片&#34;中的每个图像生成<div class="cat1 cat2 "><img ...></div>。或&#34;图片&#34;内容元素。