简体   繁体   English

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

[英]TYPO3 nested CONTENT Object with select in TMENU, no result

I am utilizing nested CATEGORIES in TYPO3 6.2.15 to generate a list of cities within countries. 我正在使用TYPO3 6.2.15中的嵌套类别来生成国家/地区内的城市列表。

So my categories look like this: 所以我的类别如下:

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

I have categorized some pages with these categories on a random basis. 我已经将一些页面随机分类为这些类别。 Now I'm outputting a TMENU with the countries for each page which works fine: 现在,我要输出一个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>
              }
            }
           }
          }
         }
        }

Next I'm trying to get the cities: Therefore I copy the whole select into the renderObj of the first one and only set the andWhere to {field:localUid} , therefore utilizing the parent IDs I have selected in the first select. 接下来,我尝试获取城市:因此,我将整个选择复制到第一个选择的renderObj中,仅将andWhere设置为{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>
              }
            }
           }
          }
         }
        }

When I view the generated query and test it in phpmyadmin it works perfectly fine. 当我查看生成的查询并在phpmyadmin中对其进行测试时,它可以很好地工作。 But on my website it delivers no results. 但是在我的网站上没有任何结果。 Any ideas why? 有什么想法吗? I tried setting the andWhere and the uid_foreign to fixed values - this will output a result BUT only on the menu items that dont share this particular uid. 我尝试将andWhere和uid_foreign设置为固定值-这只会在不共享此特定uid的菜单项上输出结果BUT。 So if my second query has the fixed id 96 ( where=sys_category_record_mm.uid_foreign = 96 ) and has cities within germany ( andWhere = sys_category.parent = '2' ) the query will only deliver a result within all other TMENU items (ie pages 95,97,98) but not in 96 ... I am lost to why this is happening. 因此,如果我的第二个查询具有固定的ID 96( where=sys_category_record_mm.uid_foreign = 96 )并且在德国andWhere = sys_category.parent = '2'有城市( andWhere = sys_category.parent = '2' ),则该查询将仅在所有其他TMENU项(即页面)中提供结果95,97,98),但不是96。。。我不知道为什么会这样。 Any ideas? 有任何想法吗? Thanks ... 谢谢 ...

I still don't know why the second select fails but I have been able to work around the problem by turning the first andWhere into a cObject that returns all countries category IDs as an OR statement. 我仍然不知道为什么第二次选择失败,但我已经能够通过转动第一要解决的问题andWherecObject返回所有的国家类别ID为OR声明。 After thats done I cut off the last OR by replacement since optionsplit is not available on the renderObj (since its always just one result that gets wrapped). 这就是完成后我切断了最后OR通过置换,因为optionsplit是不可用的renderObj (因为它始终只是一个结果是被包裹)。 This delivers all cities and I dont need the second SELECT inside the cObject anymore. 这样可以覆盖所有城市,并且我不再需要cObject内的第二个SELECT了。

            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 |
                }
              }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM