简体   繁体   中英

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.

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:

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.

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. 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. 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. 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. 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). This delivers all cities and I dont need the second SELECT inside the cObject anymore.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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