如何设置限制和订购TYPO3 HMENU

时间:2017-05-31 09:24:45

标签: typo3 typo3-7.6.x

在下面的TYPO3脚本代码中从其他菜单项获取页面列表

我想通过限制参数(限制= 5)的最新页面设置顺序

特殊目录包含子菜单条目并在主页上显示

[page|uid = 1]
lib.content_6.stdWrap.preCObject = HMENU
lib.content_6.stdWrap.preCObject {

    1 = TMENU

    wrap = <div class="wpContentElement wpReferenceList"><ul>|</ul></div>
    special = directory
    special.value = 94,95,97,378,445
    includeNotInMenu = 1
    special.range = 1|-2

    1 {
        NO.wrapItemAndSub = <li class="col-xs-12 col-sm-6 col-lg-3 col-xl-3">|</li>
        NO.stdWrap.cObject = COA
        NO.stdWrap.cObject {

            10 = TEXT
            10 {
                field = title
                wrap = <div>|</div>
            }
            20 = FILES
            20 {
                references {
                    table = pages
                    uid.field = uid
                    fieldName = tx_mask_referenceimage
                }
                renderObj = IMAGE
                renderObj {
                    file.import.data = file:current:uid
                    file.treatIdAsReference = 1
                    file.height = 850c
                    file.width  = 850c
                }
            }


        }
    }
}
[end]

1 个答案:

答案 0 :(得分:0)

最高可以使用maxItems完成,但您无法自行订购。您可以滥用additionalWhere

更清洁的解决方案是实现自己的itemArrayProcFunc

1 = TMENU
1 {
    maxItems = 5
    // additionalWhere = ORDER BY tstamp desc

    itemArrayProcFunc = user_menuItemArrayProcFunc->process
}