Kai Zwier
Kai Zwier

Reputation: 193

Typoscript - ouput category of page in menu

I'm trying to create a menu of pages. Later on I would like to use a filter in the frontend so I need my assigned categories as data-tag.

tt_content.menu.20 {
    verteilerseite < .1
    verteilerseite {    
    testmenu = HMENU
    testmenu {
        includeNotInMenu = 1
        special = list
        special.value.field = pages
        1 = TMENU
        1 {
            wrap = <ul class="nav navbar-sub">|</ul>
            NO {
                wrapItemAndSub = <li>|</li>
                wrapItemAndSub.override.cObject = COA
                wrapItemAndSub.override.cObject {

                        10 = TEXT
                        10.value = <li class="col-md-4"

   .....

my tries getting the data with a RECORD or CONTENT didn't work that's why i just posted the beginning of the code.

Upvotes: 1

Views: 1117

Answers (1)

ntiedt
ntiedt

Reputation: 183

There is no simple solution for this.
You need to do it with a select statement.

lib.pageCategories = CONTENT
lib.pageCategories {
    table = sys_category
    select {
        languageField = sys_language_uid
        pidInList = 16
        selectFields = sys_category.title
        join = sys_category_record_mm ON sys_category.uid = sys_category_record_mm.uid_local
        where = sys_category_record_mm.tablenames = "pages" AND sys_category.parent = 1
        andWhere.field = uid
        andWhere.intval = 1
        andWhere.wrap = sys_category_record_mm.uid_foreign=|
        orderBy = sys_category.sorting

        max = 1
    }
    renderObj = TEXT
    renderObj {
        field = uid
    }
}

I found a german solution and an english one.

Upvotes: 2

Related Questions