typo3 8.7.x/typoscript:无法从rootpage获取数据,幻灯片在rootpage之前停止

1tu0hz3e  于 2021-06-20  发布在  Mysql
关注(0)|答案(2)|浏览(297)

我想得到一些匹配where子句的字段。如果它不匹配,那么它应该查看父页等等。问题是,幻灯片在我的rootpage之前停止。

test = CONTENT
test {
    table = pages
    select {
      where = NOT tx_pagesaddfields_sliderimages=0
      pidInList = this
      orderBy = sorting
    }
    slide = -1
    renderObj = TEXT
    renderObj {
      field = title
      wrap = |<br />
    }
}
igetnqfo

igetnqfo1#

现在我有了一个解决问题的办法。

lib.slidertitle = CONTENT
lib.slidertitle {
  table = pages
  select {
    where = NOT tx_pagesaddfields_sliderimages=0
    pidInList = this
  }
  slide = -1

  renderObj = TEXT
  renderObj {
    field = tx_pagesaddfields_slidertitle
    wrap = |
  }

  stdWrap.ifEmpty.cObject = CONTENT
  stdWrap.ifEmpty.cObject {
    table = pages
    select {
      where = NOT tx_pagesaddfields_sliderimages=0
      pidInList = root
    }
    renderObj = TEXT
    renderObj {
        field < lib.slidertitle.renderObj.field
        wrap = |
    }
  }
}

lib.sliderimages < lib.slidertitle
lib.sliderimages.renderObj.field = tx_pagesaddfields_sliderimages
lib.sliderimages.stdWrap.ifEmpty.cObject.renderObj.field < lib.sliderimages.renderObj.field

lib.slidericon < lib.slidertitle
lib.slidericon.renderObj.field = tx_pagesaddfields_slidericon
lib.slidericon.stdWrap.ifEmpty.cObject.renderObj.field < lib.slidericon.renderObj.field
qgzx9mmu

qgzx9mmu2#

你在找根线上的第一张图片?
将字段声明为根线字段:

$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= ',tx_pagesaddfields_sliderimages'

以适当的方式访问它:

temp.image = IMAGE
temp.image {
    file {
        treatIdAsReference = 1
        import.data = levelfield:-1, tx_pagesaddfields_sliderimages, slide
        import.listNum = 0
    }
}

相关问题