开发者

How to set a variable depending of a SQL check in TypoScript?

开发者 https://www.devze.com 2023-03-29 03:34 出处:网络
There is a Database-table \"tt_conten开发者_Go百科t\" check in my TypoScript code. Depending on whether the CONTENT is empty or not, I want to set a variable VAR to \"empty\" or \"full\".

There is a Database-table "tt_conten开发者_Go百科t" check in my TypoScript code.

Depending on whether the CONTENT is empty or not, I want to set a variable VAR to "empty" or "full".

Is it possible?

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

I allready have found a way to set the MIDCONTENT itselfe to empty, by doing

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

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

But what i need, is setting another variable, and i need to check the full state either.


untested

If i unterstand you right, you want to add an class="full" to ATagParams only if there are tt_content records in that page?

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
    }
  }
}

If there are no records on that page, numRows will return 0, so if.isTrue will returns false and the TEXT object will not be rendered.


you need something like :

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

I don't have my typo3 installation with me to test. Plus, you didn't really described what you want to do... More details can help you a lot more.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号