Monday, November 30, 2015

Fetch content from multiple higher level of parent page when content in current page is empty.

temp.rightContent is fetching content of current page. Now check if this is empty we'll fetch from the parent page. This way we'll check again parent-parent i.e. grand parent page as so on. To achieve this i've take leveluid into count. We can apply different way as well. As per example below Typoscript object `lib.column_right_parent` is containing our required content.

temp.rightContent.current = CONTENT
temp.rightContent.current  {
  table = tt_content
  select.pidInList.data = leveluid : -1
  #select.pidInList.data = 1
  select.orderBy = sorting
  select.where = colPos= 2
  select.languageField = sys_language_uid
}

lib.column_right_parent < temp.rightContent.current
lib.column_right_parent.stdWrap.ifEmpty.cObject < temp.rightContent.current
lib.column_right_parent.stdWrap.ifEmpty.cObject {
  select.pidInList.data = leveluid : -2
  stdWrap.ifEmpty.cObject  < temp.rightContent.current
  stdWrap.ifEmpty.cObject {
    select.pidInList.data = leveluid : -3
    stdWrap.ifEmpty.cObject  < temp.rightContent.current
    stdWrap.ifEmpty.cObject {
      select.pidInList.data = leveluid : -4
        stdWrap.ifEmpty.cObject  < temp.rightContent.current
        stdWrap.ifEmpty.cObject {
          select.pidInList.data = leveluid : -5
      }
    }
  }
}

No comments:

Post a Comment