TYPO3如何获得子类别的父类别

时间:2017-03-24 09:20:16

标签: typo3 categories extbase tx-news

我有TYPO3(7.6.10)和tx_news(新闻管理) 我创建了一个包含新闻列表的页面。 我需要知道子类别的父类别(因为我需要设置页面标题的样式)。

我该怎么做?

1 个答案:

答案 0 :(得分:1)

  • parentcategory(tx_news)有一个属性TYPO3\CMS\Extbase\Domain\Model\Category
  • parent(核心)有一个属性<f:if condition="{newsItem.firstCategory.parentcategory}"> <f:then>{newsItem.firstCategory.parentcategory.title}</f:then> <f:else>{newsItem.firstCategory.title}</f:else> </f:if>

如果您想使用流体在新闻模板中显示父类别的标题,您可以执行以下操作:

#hexagon {
  width: 100px;
  height: 55px;
  background: red;
  position: relative;
}

#hexagon:before {
  content: "";
  position: absolute;
  top: -25px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 25px solid red;
}

#hexagon:after {
  content: "";
  position: absolute;
  bottom: -25px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-top: 25px solid red;
}
相关问题