jmcclane
jmcclane

Reputation: 189

TypoScript condition to check if specific list_type is on a page

I try to have a condition in TypoScript to find out if a certain list_type is on the page (plugin). In the docs I can't find anything about that. Is it even possible at all?

Upvotes: 1

Views: 722

Answers (2)

Jo Hasenau
Jo Hasenau

Reputation: 2684

lib.hasNewsOnPage = TEXT
lib.hasNewsOnPage {
  value = 1
  if.isTrue.numRows {
    table = tt_content
    select.where.dataWrap = pid = {TSFE:id} AND colPos = 1 AND list_type = 'news_pi1'
  }
}

Upvotes: 3

Megafry
Megafry

Reputation: 84

Try this:

Return 1 if the plugin News is fund on the current page (colpos 1)

  lib.hasNewsOnPage = TEXT
  lib.hasNewsOnPage {
    value = 0
    stdWrap {
      override {
        cObject = CONTENT
        cObject {
          table = tt_content
          select {
            where = colPos=1 AND list_type = 'news_pi1'
            max = 1
          }
          renderObj = TEXT
          renderObj {
            value = 1
          }
        }
      }
    }
  }

Upvotes: 1

Related Questions