0

我的 TypoScript 代码中有一个数据库表“tt_content”检查。
根据内容是否为空,我想将变量 VAR 设置为“空”或“满”。
是否可以?

MIDCONTENT= CONTENT
MIDCONTENT{
  table = tt_content
  select.orderBy = sorting
  select.where = colPos = 0  
}

我已经找到了一种将 MIDCONTENT 本身设置为空的方法,方法是

MIDCONTENT= CONTENT
MIDCONTENT{
  table = tt_content
  select.orderBy = sorting
  select.where = colPos = 0  

  stdWrap.ifEmpty.cObject = TEXT
  stdWrap.ifEmpty.cObject.value = empty
}

但我需要的是设置另一个变量,我也需要检查完整状态。

4

2 回答 2

0

你需要类似的东西:

enable = 1
enable.if.isTrue.field = MIDCONTENT

我没有带我的typo3安装来测试。另外,你并没有真正描述你想做什么......更多细节可以帮助你更多。

于 2011-08-19T23:03:39.010 回答
0

未经测试

如果我对您的理解正确,您是否只想在该页面中有 tt_content 记录时才向 ATagParams 添加一个 class="full" ?

NO.ATagParams.append = TEXT
NO.ATagParams.append {
  value = class="full"
  # Space before and after
  noTrimWrap = | | |
  if.isTrue.numRows {
    table = tt_content
    select {
      where = colPos = 0 
      # the uid of the page, is the pid of the tt_content elements
      pidInList.field = uid
    }
  }
}

如果该页面上没有记录,则 numRows 将返回 0,因此 if.isTrue 将返回 false 并且不会呈现 TEXT 对象。

于 2011-11-08T12:06:51.873 回答