Search code examples
typo3tx-news

typoscript for a news category menu searched


i'm searching for a news category menu with subcategories and number of relevant items.

There is on existing: https://www.fiedomedia.de/news/artikel/news-kategorien-mit-counter/

This typoscript seems not to work in TYPO3 8.7.1

The number of items is wrong and the subcategories are repeated under every main category.

Has somebody a working script?


Solution

  • You can adjust the fluid-template for categories https://github.com/georgringer/news/blob/master/Resources/Private/Templates/Category/List.html and use the count-viewhelper there https://fluidtypo3.org/viewhelpers/fluid/master/CountViewHelper.html

    I did something like that some time ago with the dateMenu:

    <f:section name="content">
        <ul class="vertical menu">
            <f:for each="{data.single}" key="year" as="months">
                <li>
                    <a>{year}</a>
                    <ul class="vertical menu nested">
                        <f:for each="{months}" key="month" as="count">
                            <f:if condition="{0:year, 1:month} == 
    {0:overwriteDemand.year, 1:overwriteDemand.month}">
                                <f:then>
                                    <li class="item active">
                                </f:then>
                                <f:else>
                                    <li class="item">
                                </f:else>
                            </f:if>
                                <f:link.action pageUid="{listPid}" arguments="
    {overwriteDemand:{year: year, month: month}}"><f:translate key="month.
    {month}" /> {year}
    ({count})</f:link.action>
    
                            </li>
                        </f:for>
                    </ul>
                </li>
            </f:for>
        </ul>
    </f:section>