TYPO3:如何将页面内容插入模板

发布于 2024-07-26 08:38:18 字数 224 浏览 11 评论 0原文

我有一些内容想要出现在 TYPO3 网站的多个页面上。 我可以将其插入模板中,但我还希望该内容可以在富文本编辑器中编辑。

所以我有了创建隐藏页面的想法,但我不知道如何将此内容插入到模板中。

它是否需要 select 打字语句?

另外,作为后续问题,我可以添加一些内容吗?仅包含将此页面 ID 作为页面层次结构中直接父级的页面。

I have some content that I want to appear on multiple pages of my TYPO3 site. I could just insert this into the template, but I also want that content to be editable in the Rich Text Editor.

So I had the idea of creating a hidden page, but I don't know how to insert this content into a template.

Does it require the select typoscript statement?

Also, as a follow-up question, can I add something to say, only include pages that have this page id as their immediate parent in the page hierarchy.

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

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

发布评论

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

评论(3

沩ん囻菔务 2024-08-02 08:38:18

我不太明白第二个问题。
如果您只想将某些记录包含到其他页面下的页面,那么这显然会起作用:

[PIDinRootline = pages-uid, pages-uid, ...]
temp.foo = RECORDS
temp.foo {
    tables = tt_content
    source = ID # Enter the object's ID here
}
[end]

另一方面,如果您想包含页面中的所有记录,作为其他页面的子页面,那么请尝试以下操作:

1 = CONTENT
  1.table = tt_content
  1.select {
    pidInList = parent-uid
  }

Don'不知道我是否理解对了你。
德米特里。

I didn't quite get the second question.
If you want to include some record only to pages under some other page, then this will obviously work:

[PIDinRootline = pages-uid, pages-uid, ...]
temp.foo = RECORDS
temp.foo {
    tables = tt_content
    source = ID # Enter the object's ID here
}
[end]

On the other hand, if you want to include all records from pages, being children of some other page, then try something like:

1 = CONTENT
  1.table = tt_content
  1.select {
    pidInList = parent-uid
  }

Don't know if I got you right though.
Dmitri.

羅雙樹 2024-08-02 08:38:18

来自在每个页面上包含typo3内容元素:

temp.foo = RECORDS
temp.foo {
    tables = tt_content
    source = ID # Enter the object's ID here
}

注意ID是内容记录ID,而不是页面ID。

但这并不能回答如何仅包含特定父级的页面/记录的问题。

From Include typo3 content elements on every page:

temp.foo = RECORDS
temp.foo {
    tables = tt_content
    source = ID # Enter the object's ID here
}

Note the ID is the content record ID, not the page ID.

But that doesn't answer the question of how to only include pages/records with a certain parent.

颜漓半夏 2024-08-02 08:38:18

您可以设置隐藏页面,然后根据需要通过页面(或下面的整个页面树)上的打字稿“导入”给定页面上的内容元素。
“技巧”是将 colPos 与 select 语句一起使用。 通过此功能,您甚至可以将多个(不同)内容元素放入一个(隐藏)页面中,这些内容元素显示在不同页面上(取决于它们所在的列的设置。

示例:

  • 创建一个隐藏(或系统)页面(此处example-pageid = $PID_STATIC)
  • 在此页面上创建内容元素(文本)
  • 编辑此内容元素以显示在右列上(右等于 colPos=2)
  • 将以下打字稿放入您希望内容元素所在的模板中您可以通过 PID_STATIC 在常量中设置 pid (pageId) 或将其“硬编码”到

lib.aditionalcontent = COA
lib.aditionalcontent { 
   10 = CONTENT
    10 {
        table = tt_content
        select.where = colPos = 2
        select.orderBy = sorting
        select.pidInList = {$PID_STATIC}
    }
  • 应该显示内容的模板中 示例:

page.10 = TEMPLATE
page.10.template = FILE
page.10.template.file = fileadmin/maintemplate.htm
page.10.workOnSubpart = DOCUMENT_BODY
page.10.marks.ADITIONAL_CONTENT < lib.aditionalcontent

注意

,您根据已设置内容元素的列来设置 colPos,否则

您可以使用不同的列来对必须显示/应该显示的不同内容执行此操作 。不显示在特定页面上。

这也适用于系统文件夹和非隐藏页面。

如果您使用 TemplaVoila,这也应该可以工作,尽管您必须切换到列表视图才能查看和设置内容元素的列(如果没有对此非管理员用户隐藏)。

要找出哪个 colPos-number 是列的哪个位置,请转到 phpMyAdmin 并在 tt_content 表中搜索字段“colPos”。

You can set up a hidden page and then "import" the content elements on a given page via typoscript on the pages (or the entire page tree below) as needed.
The "trick" is to use the colPos with the select-statement. With this you can even put multiple (different) content elements in one (hidden) page that show up on different pages (depending on the setting of the column they are "in".

Example:

  • Create a hidden (or system) page (here example-pageid = $PID_STATIC)
  • Create a content element on this page (text)
  • Edit this content element to be shown on the right column (right equals colPos=2)
  • Put the following typoscript into the template on which you want the content element to be shown. You can set the pid (pageId) in the constants via PID_STATIC or "hardcode" it into the typoscript.

.

lib.aditionalcontent = COA
lib.aditionalcontent { 
   10 = CONTENT
    10 {
        table = tt_content
        select.where = colPos = 2
        select.orderBy = sorting
        select.pidInList = {$PID_STATIC}
    }
  • Add the element lib.aditionalcontent into your template where the content should be shown. For example:

.

page.10 = TEMPLATE
page.10.template = FILE
page.10.template.file = fileadmin/maintemplate.htm
page.10.workOnSubpart = DOCUMENT_BODY
page.10.marks.ADITIONAL_CONTENT < lib.aditionalcontent

.

Watch out, that you set the colPos according to the column that you have set the content element into, otherwise it just will not show.

You can use different columns to do this for different content that has to show up/should not show up on a particular page.

This also works with sytemfolders and non-hidden pages.

If you use TemplaVoila, this should also work although you have to switch to the listview to see and set the colum for the content element (if not hidden for this non-admin user).

To find out which colPos-number is which position of the column go to the phpMyAdmin and search for the field "colPos" in the tt_content table.

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