[英]TYPO3 nested CONTENT Object with select in TMENU, no result
我正在使用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
中,僅將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>
}
}
}
}
}
}
當我查看生成的查詢並在phpmyadmin中對其進行測試時,它可以很好地工作。 但是在我的網站上沒有任何結果。 有什么想法嗎? 我嘗試將andWhere和uid_foreign設置為固定值-這只會在不共享此特定uid的菜單項上輸出結果BUT。 因此,如果我的第二個查詢具有固定的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。。。我不知道為什么會這樣。 有任何想法嗎? 謝謝 ...
我仍然不知道為什么第二次選擇失敗,但我已經能夠通過轉動第一要解決的問題andWhere
成cObject
返回所有的國家類別ID為OR
聲明。 這就是完成后我切斷了最后OR
通過置換,因為optionsplit
是不可用的renderObj
(因為它始終只是一個結果是被包裹)。 這樣可以覆蓋所有城市,並且我不再需要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.