TYPO3 content on one page order by position in pagetree

让人想犯罪 __ 提交于 2019-12-11 14:48:37

问题


I'm showing all content from the subpages on one page:

lib.allPid = COA
lib.allPid {
    10 = HMENU
    10 {
        #entryLevel = 1
                special = directory
                special.value = 115
        1 = TMENU
        1 {
            expAll = 1
            NO.doNotShowLink = 1
            NO.allStdWrap.field = uid
            NO.allStdWrap.wrap = |,
        }
        2 < .1
    }
}

lib.allContent = CONTENT
lib.allContent {
    table = tt_content
    select {
        pidInList.cObject < lib.allPid
                where = colPos = 0
                orderBy = pid DESC
    }
}

Here the content is ordere by pid DESC. But I'd like to order the content from the subpages by their position in the pagetree. So that the user can define his own ordering.

I tried:

lib.allContent = CONTENT
lib.allContent {
  table = tt_content
  select {
    pidInList.cObject < lib.allPid
    leftjoin = pages ON (tt_content.pid = pages.pid)
                where = tt_content.colPos = 0                    
                orderBy = pages.sorting ASC
  }
}

Didn't work...

Does anyone know how to do this? Thanks in advance!


回答1:


You are on a good way, but you made the join wrong.

In your code it is tt_content.pid = pages.pid, and this one is wrong. The pid value in tt_content is the uid from the pages.

You need to change your script so:

lib.allContent = CONTENT
lib.allContent {
  table = tt_content
  select {
    pidInList.cObject < lib.allPid
    leftjoin = pages ON (tt_content.pid = pages.uid)
                where = tt_content.colPos = 0                    
                orderBy = pages.sorting ASC
  }
}

I tested it, and it worked on a test instance.



来源:https://stackoverflow.com/questions/37327440/typo3-content-on-one-page-order-by-position-in-pagetree

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!