简体   繁体   English

TYPO3-打字稿-sys_category

[英]TYPO3 - typoscript - sys_category

I'm trying to display the title of the sys_category of a given content-element in a list-view, here a sysfile, but i can't get the single cat for each element, what I'm doing wrong? 我正在尝试在列表视图中显示给定内容元素的sys_category的标题,这里是sysfile,但是我无法为每个元素都放一个猫,我在做什么错了? I know, this question has been asked before, but there is no fitting answer yet. 我知道,这个问题已经被问过了,但是还没有合适的答案。 No fluid, please TS ;) 没有液体,请TS;)

lib.category = COA
lib.category {
10 = CONTENT
  10 {
    table = sys_category
    select {
      pidInList = 1
      join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
      # static id works
      #where = (uid_foreign = 751) 
      # here is the mistake?
      where.data = (uid_foreign = uid)  
      selectFields = title
    }

    renderObj = TEXT
    renderObj.field = title
    renderObj.wrap = Kategorie:|

    stdWrap.ifEmpty.cObject = TEXT
    stdWrap.ifEmpty.cObject.value = no-cat
    }
  }
}

Assuming you have everything in your current record in cObject->data available, you can access it like this: 假设当前记录中的所有内容都在cObject-> data中可用,则可以像这样访问它:

lib.category = COA
lib.category {
  10 = CONTENT
  10 {
    table = sys_category
    select {
      pidInList = 1
      join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
      where.data = field:uid
      where.intval = 1
      where.wrap = (uid_foreign = |)  
      selectFields = title
    }

    renderObj = TEXT
    renderObj.field = title
    renderObj.noTrimWrap = |Category: ||

    stdWrap.ifEmpty = no-cat
  }
}

I also simplified and optimized the rendering of the category and ifEmpty rendering. 我还简化和优化了类别和ifEmpty呈现的呈现。

Please note that this only works to get categories of ONE content element. 请注意,这仅适用于获取一个内容元素的类别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM