mysql - 拼写错误3 : CASE not working with additional field in sys_file_reference

标签 mysql typoscript typo3-6.2.x

我使用自己的扩展在表“sys_file_reference”中构建了一个名为“tx_references_special”的新字段。在typo3后端的“textpic”内容元素中,我可以通过在BE中的图片上检查该数组来选择该字段。因此在数据库中,字段“tx_references_special”为“0”或“1”。

我想仅为 textpic-elements 中的“使用此数组选择的”图片定义类。因此,我在主模板设置中构建了以下 typescript 。 问题是,在此 CE 上,两张图片仅呈现“默认”类。有谁知道为什么吗?

lib.projects=CONTENT
lib.projects{
table = tt_content
select {
where = header_layout = 14
}  
renderObj = COA
renderObj {
10 = TEXT
10.field = header
10.wrap=<div id="header_projects">|</div>

20 = TEXT
20.field = bodytext
20.wrap=<div id="bodytext_projects">|</div>

30=FILES
30{
  references{
    table=tt_content
    fieldName=image
  }

  renderObj=CASE
  renderObj{
    key.data=sys_file_reference:tx_references_special

    default=IMAGE
    default {
      wrap=<div class="default">|</div>
      file{
        width=313m
        height=220m
        import.data=file:current:publicUrl
      }

    }

    1=IMAGE
    1 {
      wrap=<div class="itworks">|</div>
      file{
        width=313m
        height=220m
        import.data=file:current:publicUrl
      }
    }
  }
}
}
}

最佳答案

早上好,

我通过其他方式得到了它。

我的目标是为图片分配不同的类别来定位它们。使用下面的代码就可以了。如果我在 BE 中设置该值,图片将获得类 app_pic,如果我没有设置,图片将获得类图标。

lib.projects=CONTENT
lib.projects{
table = tt_content
select {
  where = header_layout = 14
}  
renderObj = COA
renderObj {
  10 = TEXT
  10.field = header
  10.wrap=<div id="header_projects">|</div>

  20 = TEXT
  20.field = bodytext
  20.wrap=<div id="bodytext_projects">|</div>

  30=FILES
  30{
    references{
      table=tt_content
      fieldName=image
    }

    renderObj=IMAGE
    renderObj{
      stdWrap.wrap=<div class="app_pic">|</div>
      stdWrap.wrap.override=<div class="icon">|</div>
      stdWrap.wrap.override.if {
        value=1
        equals.data=file:current:tx_references_special
      }
      file{
        width=313m
        height=220m
        import.data=file:current:publicUrl
      }
    }

    }
    }
    }

关于mysql - 拼写错误3 : CASE not working with additional field in sys_file_reference,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27958084/

相关文章:

debugging - 流畅调试——输出所有变量

mysql - 尝试为我的数据库编写 Mysql 查询

mysql - 将模板智能标签 <<tag>> 替换为 mysql 中的 [tag]

php - MySQL。一张表的负载转储

typoscript - 如何为TYPO3内容元素表添加布局样式选项?

typo3 - 如何编辑: TypoScript Configuration » Page TSConfig?

php - PHP 和 MySQL 中的数据相同

TYPO3新闻扩展名、图片上传大小

php - mysql 'LEFT JOIN' for "exec_SELECTquery"in typo3 version 6.2

typo3 - 获取扩展不起作用 - 如何修复它?