TYPO3嵌套了CONTENT对象,在TMENU中选择,没有结果

时间:2015-12-08 16:44:15

标签: select typo3 typoscript

我正在利用TYPO3 6.2.15中的嵌套类别来生成国家/地区内的城市列表。

所以我的类别看起来像这样:

LOCATIONS (ID 1)
    GERMANY (ID 2)
        Trier (ID 7)
        Stuttgart (ID 8)
        Bonn (ID 9)
    FRANCE (ID 3)
        Paris (ID 4)
        Marseille (ID 5)

我已经随机地对这些类别的某些页面进行了分类。现在我输出一个TMENU,每个页面的国家/地区都可以正常工作:

page.120 = HMENU
page.120 {
    special = directory
    special.value = 92
    1 = TMENU
    1.NO {
     doNotLinkIt = 1
     stdWrap.cObject = COA
     stdWrap.cObject {
        5 = COA
        5 {
          10 = CONTENT
          10 {
            noTrimWrap = |<div>{field:uid}: |</div>|
            noTrimWrap.insertData = 1
            table = pages
            select {
              pidInList = 92 
              selectFields = sys_category_record_mm.uid_local as localUid, sys_category.title as sysTitle
              join = sys_category_record_mm ON pages.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local
              where = sys_category_record_mm.uid_foreign = {field:uid} AND sys_category.deleted = 0
              where.insertData = 1
              andWhere = sys_category.parent = '1'
              orderBy = localUid
            }
            renderObj = COA
            renderObj {
              10 = TEXT
              10 {
              field = sysTitle
              wrap = <p>|</p>
              }
            }
           }
          }
         }
        }

接下来我试图获取城市:因此我将整个选择复制到第一个的renderObj中,并且只将theWhere设置为{field:localUid},因此使用父ID我已在第一个选择中选择。

page.120 = HMENU
page.120 {
    special = directory
    special.value = 92
    1 = TMENU
    1.NO {
     doNotLinkIt = 1
     stdWrap.cObject = COA
     stdWrap.cObject {
        5 = COA
        5 {
          10 = CONTENT
          10 {
            table = pages
            select {
              pidInList = 92 
              selectFields = sys_category_record_mm.uid_local as localUid, sys_category.title as sysTitle
              join = sys_category_record_mm ON pages.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local
              where = sys_category_record_mm.uid_foreign = {field:uid} AND sys_category.deleted = 0
              where.insertData = 1
              andWhere = sys_category.parent = '1'
              orderBy = localUid
            }
            renderObj = COA
            renderObj {
              10 = TEXT
              10 {
              field = sysTitle
              wrap = <p>|</p>
              }
          20 = CONTENT
          20 {
            table = pages
            select {
              pidInList = 92 
              selectFields = sys_category_record_mm.uid_local as localUid2, sys_category.title as sysTitle2
              join = sys_category_record_mm ON pages.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local
              where = sys_category_record_mm.uid_foreign = {field:uid} AND sys_category.deleted = 0
              where.insertData = 1
              andWhere = sys_category.parent = '{field:localUid}'
              andWhere.insertData = 1
              orderBy = localUid2
            }
            renderObj = COA
            renderObj {
              10 = TEXT
              10 {
              field = sysTitle2
              wrap = <p>|</p>
              }
            }
           }
          }
         }
        }

当我查看生成的查询并在phpmyadmin中测试它时,它完全正常。但在我的网站上它没有提供任何结果。有什么想法吗?我尝试将andWhere和uid_foreign设置为固定值 - 这将仅在不共享此特定uid的菜单项上输出结果BUT。因此,如果我的第二个查询具有固定ID 96(where=sys_category_record_mm.uid_foreign = 96)并且德国境内的城市(andWhere = sys_category.parent = '2'),则查询将仅在所有其他TMENU项目中提供结果(即第95,97,98页)但不是96 ... 我迷失了为什么会这样。有任何想法吗?谢谢......

1 个答案:

答案 0 :(得分:0)

我仍然不知道为什么第二个选择失败但我能够通过将第一个andWhere转换为cObject来解决问题,该OR将所有国家/地区的类别ID作为OR声明。完成后,我切换了最后optionsplit替换,因为renderObj上没有SELECT(因为它总是只有一个被包裹的结果)。这会传递所有城市,我不再需要cObject内的第二个 select.andWhere.cObject = CONTENT select.andWhere.cObject { wrap = (|) stdWrap.replacement { 10 { search = OR ) replace = ) } } table = pages select { pidInList = 92 selectFields = sys_category_record_mm.uid_local as localUid, sys_category.title as sysTitle join = sys_category_record_mm ON pages.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local where = sys_category_record_mm.uid_foreign = {field:uid} AND sys_category.deleted = 0 where.insertData = 1 andWhere = sys_category.parent = '1' orderBy = localUid } renderObj = COA renderObj { 5 = TEXT 5.field = localUid 5.noTrimWrap = |sys_category.parent ='|' OR | } }

private int ProxyQueueTimeoutMs => ((MultiProxyCrawlConfiguration) _config).ProxyQueueTimeoutMs;