Git Product home page Git Product logo

Comments (2)

DavidBruchmann avatar DavidBruchmann commented on July 22, 2024

For Detail-view in typo3conf/ext/news/Resources/Private/Partials/Category/Items.html replace the code by this, links to show news of only one category then are included:

<!-- categories -->
<span class="news-list-category">
    <f:for each="{categories}" as="category" iteration="iteratorCategories">
        <f:if condition="{category.shortcut}">
            <f:then>
                <f:link.action pageUid="{category.shortcut}" arguments="{overwriteDemand:{categories:category.uid}}">{category.title}</f:link.action>
            </f:then>
            <f:else>
                <f:link.action pageUid="{settings.backPid}" arguments="{overwriteDemand:{categories:category.uid}}">{category.title}</f:link.action>
            </f:else>
        </f:if>
        <f:if condition="{iteratorCategories.isLast}">
            <f:then></f:then>
            <f:else>,</f:else>
        </f:if>
    </f:for>
</span>

For list-view you can use nearly the same snippet but it's still a bit different:

<f:if condition="{newsItem.categories}">
    <span class="news-list-category">
        <f:for each="{newsItem.categories}" as="category" iteration="iteratorCategories">
            <f:if condition="{category.shortcut}">
                <f:then>
                    <f:link.action pageUid="{category.shortcut}" arguments="{overwriteDemand:{categories:category.uid}}">{category.title}</f:link.action>
                </f:then>
                <f:else>
                    <f:link.action arguments="{overwriteDemand:{categories:category.uid}}">{category.title}</f:link.action>
                </f:else>
            </f:if>
            <f:if condition="{iteratorCategories.isLast}">
                <f:then></f:then>
                <f:else>,</f:else>
            </f:if>
        </f:for>
    </span>
</f:if>

from news.

spacexplorer avatar spacexplorer commented on July 22, 2024

I have a system category tree in Typo3:

─┬─A─┬─A1
 │   └─A2
 │
 └─B─┬─B1
     ┼─B2
     └─B3

I want to render the children of B tree.

On each child news item I am able to get the categories in a string on every iteration

    <f:for each="{news}" as="newsItem" iteration="iterator">
        <!-- render partial="List/ServiceItem" -->
    <div
    <f:if condition="{newsItem.categories}">
				data-groups="[<f:for each="{newsItem.categories}" as="category" iteration="iteratorCategories">'{category.title}'<f:if condition="{iteratorCategories.isLast}"><f:then></f:then><f:else>,</f:else></f:if></f:for>]"
			</f:if>
    >{newsItem.title} & other stuff</div>
    </f:for>

I am using Shuffle.js to filter the list and I need all the B - tree children to create the group control
I tried this:

    <div class="news-list-category"> categories:
      <f:for each="{categories}" as="category" iteration="iteratorCategories">
        <f:if condition="{category.title} == 'B'">
          {category.title}
           <f:debug>{category.children}</f:debug>
           <f:if condition="{category.children}">
                children:
                <f:for each="{category.children}"
                          as="subCategory"
                           iteration="iteratorSubCategories">
                     <span>{subCategory.title}</span>
                 </f:for>
              </f:if>
         </f:if>
      </f:for>
    </div>

category.children and category.item.children
returns null

if condition="{category.title} == 'B'
gets to the correct first level item

I used
typo3conf/ext/news/Resources/Private/Templates/Styles/Twb/Templates/Category/List.html

as a reference as well

Should I rather do this in typoscript and pass to fluid

 <f:cObject typoscriptObjectPath="lib.myTyposSubCategoryList" />

I'll go and see if I can get Typoscript to render this but would like a fluid solution

Thanks
also in this thread:
https://stackoverflow.com/questions/51491216/typo3-list-children-of-a-specific-system-category-news-extension

from news.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.