Search code examples
typo3typo3-6.1.x

TYPO3 tx_news category layout


I'm running TYPO3 v. 6.1 with FLUID/EXTBASE.

I have installed the EXT News System (news) and it's working fine.

I have added Archive and the CATMENU, but I have some issue with the Categories list (Kategori) and it's bc of "category.item.uid" and "category.children" how do I edit the layout so I get a line between every link, like if u look at the last link "Generelt" I have the two lines as I wan't, bc. there is no sub-link for that category.

And how can I add a ( x ) after the category that shows the value of news in the category.

http://codem.dk/blog/

I have this code in the category list.html

{namespace n=Tx_News_ViewHelpers}
<f:layout name="General" />
<!--
  =====================
    Templates/Category/List.html
-->

<f:section name="content">
  <f:if condition="{categories}">
    <f:then>


      <f:render section="categoryTree" arguments="{categories:categories,overwriteDemand:overwriteDemand}" />
    </f:then>
    <f:else>
      <f:translate key="list_nocategoriesfound" />
    </f:else>
  </f:if>
</f:section>

<f:section name="categoryTree">
  <div id="categories-2" class="widget widget_meta widget_categories">
  <ul>
    <f:for each="{categories}" as="category">
      <li class="cat-item">
        <f:if condition="{category.item.uid} == {overwriteDemand.categories}">
          <f:then>
            <f:link.page class="active" pageUid="{settings.listPid}"
              additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
            </f:link.page>
          </f:then>
          <f:else>
            <f:link.page pageUid="{settings.listPid}" additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
            </f:link.page>
          </f:else>
        </f:if>

        <f:if condition="{category.children}">
          <f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand}" />
        </f:if>
      </li>
    </f:for>
  </ul>
</div>
</f:section>

Solution

  • Don't know if there is a better way, but I removed the div and ul from the categoryTree section and added em to the content section.

    That fixed the problem.

    {namespace n=Tx_News_ViewHelpers}
    <f:layout name="General" />
    <!--
      =====================
        Templates/Category/List.html
    -->
    
    <f:section name="content">
      <div id="categories-2" class="widget widget_meta widget_categories">
      <ul>
      <f:if condition="{categories}">
        <f:then>
          <f:render section="categoryTree" arguments="{categories:categories,overwriteDemand:overwriteDemand}" />
        </f:then>
        <f:else>
          <f:translate key="list_nocategoriesfound" />
        </f:else>
      </f:if>
      </ul>
    </div>
    </f:section>
    
    <f:section name="categoryTree">
        <f:for each="{categories}" as="category">
          <li class="cat-item">
            <f:if condition="{category.item.uid} == {overwriteDemand.categories}">
              <f:then>
                <f:link.page class="active" pageUid="{settings.listPid}"
                  additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
                </f:link.page>
              </f:then>
              <f:else>
                <f:link.page pageUid="{settings.listPid}" additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
                </f:link.page>
              </f:else>
            </f:if>
    
            <f:if condition="{category.children}">
              <f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand}" />
            </f:if>
          </li>
        </f:for>
    </f:section>