TYPO3 系统类别

发布于 2025-01-15 01:51:12 字数 947 浏览 4 评论 0原文

我正在使用 TYPO3 10 和新闻扩展。我的新闻页面分为四个选项卡,使用类别作为选项卡名称。我尝试输出类别,例如当前选择的选项卡名称,并希望使用打字稿作为标题标签中的标题输出,我该怎么做?

这是我当前的 TypoScript:

[page["uid"] == 6]

lib.categoryTitle = CONTENT
lib.categoryTitle {
    if.isTrue.data = GP:tx_news_pi1|news
    table = tx_news_domain_model_news
    select {
        uidInList.data = GP:tx_news_pi1|news
        pidInList = 57
        join = sys_category_record_mm ON tx_news_domain_model_news.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local
        orderBy = sys_category.sorting
        max = 1
    }
    renderObj = TEXT
    renderObj {
        field = title
        htmlSpecialChars = 1
    }
}

page = PAGE
page {
  headerData {
    10 = TEXT
    10 {
      field = title
      noTrimWrap = |<title>News zu: | </title>|
    }
  }
}

page.headerData.10 =
page.headerData.10 < lib.categoryTitle

[END]

I am using TYPO3 10 and the news extension. My news page is separatet into four tabs that uses the category as tab name. I try to output the category, e.g. tab name if is current selected and want to output as title in the title-tag by using typoscript, how can I do that?

This is my current TypoScript:

[page["uid"] == 6]

lib.categoryTitle = CONTENT
lib.categoryTitle {
    if.isTrue.data = GP:tx_news_pi1|news
    table = tx_news_domain_model_news
    select {
        uidInList.data = GP:tx_news_pi1|news
        pidInList = 57
        join = sys_category_record_mm ON tx_news_domain_model_news.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local
        orderBy = sys_category.sorting
        max = 1
    }
    renderObj = TEXT
    renderObj {
        field = title
        htmlSpecialChars = 1
    }
}

page = PAGE
page {
  headerData {
    10 = TEXT
    10 {
      field = title
      noTrimWrap = |<title>News zu: | </title>|
    }
  }
}

page.headerData.10 =
page.headerData.10 < lib.categoryTitle

[END]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

娇妻 2025-01-22 01:51:12

您在复制时覆盖了 page.headerData.10 的类型: page.headerData.10 page.headerData.10 page.headerData.10 page.headerData.10 page.headerData.10 page.headerData.10 lib.categoryTitle。所以它现在是一个 CONTENT-cobject,它没有 stdWrap-数据类型。因此,不再考虑 noTrimWrap

但它有一个 stdWrap 属性:将换行移动到 page.headerData.10.stdWrap.noTrimWrap 。然后,就会再次出现标题标签,浏览器将不会默认该 URL。


2022-03-17 更新:

应用 lib.categoryTitle 的副本并进行上述修改后,它的计算结果应为 TypoScript:

page = PAGE
page {
  headerData {
    10 = CONTENT
    10 {
      field = title
      stdWrap.noTrimWrap = |<title>News zu: | </title>|
      
      if.isTrue.data = GP:tx_news_pi1|news
      table = tx_news_domain_model_news
      select {
        uidInList.data = GP:tx_news_pi1|news
        pidInList = 57
        join = sys_category_record_mm ON tx_news_domain_model_news.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local
        orderBy = sys_category.sorting
        max = 1
      }

      renderObj = TEXT
      renderObj {
        field = title
        htmlSpecialChars = 1
      }
    }
  }
}

field is no property of CONTENT< /code>,所以应该被忽略并且输出不能是“News zu: 'Pagetitle'”

You are overriding the type of page.headerData.10 while copying: page.headerData.10 < lib.categoryTitle. So it's a CONTENT-cobject now, which does not have stdWrap-data type. So the noTrimWrap is not taken into account anymore.

But it has a stdWrap-property: move the wrap to page.headerData.10.stdWrap.noTrimWrap. Then, there will be a title-tag again, and the browser won't default to the URL.


Update 2022-03-17:

With the copy of lib.categoryTitle applied and the above modification, it should evaluate as TypoScript:

page = PAGE
page {
  headerData {
    10 = CONTENT
    10 {
      field = title
      stdWrap.noTrimWrap = |<title>News zu: | </title>|
      
      if.isTrue.data = GP:tx_news_pi1|news
      table = tx_news_domain_model_news
      select {
        uidInList.data = GP:tx_news_pi1|news
        pidInList = 57
        join = sys_category_record_mm ON tx_news_domain_model_news.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local
        orderBy = sys_category.sorting
        max = 1
      }

      renderObj = TEXT
      renderObj {
        field = title
        htmlSpecialChars = 1
      }
    }
  }
}

field is no property of CONTENT, so it should be ignored and output can't be "News zu: 'Pagetitle'"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文