0
votes

What's a good way to create a sys_category menu in TYPO3?

I'd like to render an alphabetic list of all sys_categories that are children of a certain category. Passing it to a fluid template, of course. To build a menu of all categories and link them to their sys_category.shortcut pages.

I've experimented with the following approaches

(Ab)use the category menu from news:

lib.category_nav = USER
lib.category_nav {
      userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
      extensionName = News
      pluginName = Pi1
      vendorName = GeorgRinger
      switchableControllerActions {
        Category {
          1 = list
        }
      }
      settings < plugin.tx_news.settings
      settings {
        startingpoint = 123
        categories = 456
        categoryConjunction = or
        includeSubCategories = 1
      }
      view =< plugin.tx_news.view
}

Via TypoScript (must be wrong, no output)

lib.category_nav2 = CONTENT
lib.category_nav2 {
    wrap = <p class="categories">|</p>
    table = sys_category
    select {
      orderBy = sys_category.title
    }
    renderObj = FLUIDTEMPLATE
    renderObj {
      file = {$customContentTemplatePath}/Category/List.html
    }
  }

Using News to display a list of sys_categories seems somewhat odd. What is a good approach?

1

1 Answers

0
votes

No need to abuse news. I've skipped the tree rendering challenge, though.

I simply isolated the categories I need on a sysfolder, so it's not an universal solution.

This TS is sufficient (I was already writing ViewHelpers with usort for multidimensional arrays..)

lib.category_list = CONTENT
lib.category_list {
    table = sys_category
    select {
      orderBy = sys_category.title
      pidInList = {$pidMyCategories}
    }
    renderObj = FLUIDTEMPLATE
    renderObj {
      file = {$customContentTemplatePath}/Category/MyItem.html
    }
  }

The question remains how this would be done by category tree starting point instead of pid.