Typo3:使用打字稿显示第一个子页面的内容

发布于 2024-11-14 04:54:05 字数 602 浏览 5 评论 0原文

这就是我想要做的:在给定页面上,我想显示给定页面的第一个子页面的所有内容元素。我不能简单地使用快捷方式页面,因为我需要在子页面的内容元素之后显示其他内容元素。我该怎么做?

这是我认为如何做到这一点的片段,但我不知道如何构建选择。有更好的办法吗?

# save current content
tmp.pagecontent < page.10.subparts.main-content

# clear the content of the main column
page.10.subparts.main-content >

# build a new object for this column as content-object-array
page.10.subparts.main-content = COA
page.10.subparts.main-content {
  10 = CONTENT
  10.table = tt_content
  10.select {
    # what should I put here?
  }
# re-insert the normal pagecontent to the page  
20 < tmp.pagecontent

This is what I want to do: on a given page, I want to display all content elements of the first child page of a given page. I cannot simply use a shortcut page, because I need to display other content elements after the ones from the sub-page. How can I do this?

Here is a snippet of how I think I could do it, but I don't know how to build the select. Is there a better way?

# save current content
tmp.pagecontent < page.10.subparts.main-content

# clear the content of the main column
page.10.subparts.main-content >

# build a new object for this column as content-object-array
page.10.subparts.main-content = COA
page.10.subparts.main-content {
  10 = CONTENT
  10.table = tt_content
  10.select {
    # what should I put here?
  }
# re-insert the normal pagecontent to the page  
20 < tmp.pagecontent

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

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

发布评论

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

评论(2

椵侞 2024-11-21 04:54:05

只需添加其他人的答案即可。
First :指定当前页面的第一个子页面。
第二:获取该子页面所需的内容元素。

temp.content = COA
temp.content {
  10 = CONTENT
  10 {
    table = pages
    select {
      pidInList.field = uid
      orderBy = sorting ASC
      max = 1
      begin = 0
    }
    renderObj = COA
    renderObj {
      10 = CONTENT
      10 {
        table = tt_content
        select {
          languageField = sys_language_uid
          pidInList.field = uid
          orderBy = sorting
          #where = colPos = 10
        }
        stdWrap.wrap = |
      }
    }
  }
}

Just add answer for other people.
First : specify the first sub page of current page.
Second : get content elements that you want of that sub page.

temp.content = COA
temp.content {
  10 = CONTENT
  10 {
    table = pages
    select {
      pidInList.field = uid
      orderBy = sorting ASC
      max = 1
      begin = 0
    }
    renderObj = COA
    renderObj {
      10 = CONTENT
      10 {
        table = tt_content
        select {
          languageField = sys_language_uid
          pidInList.field = uid
          orderBy = sorting
          #where = colPos = 10
        }
        stdWrap.wrap = |
      }
    }
  }
}
云裳 2024-11-21 04:54:05

我终于成功了!虽然不确定这是最好的方法。你对此有何看法?我是否也应该将第二个选择放入 userFunc 中?

fileadmin/userfunc/mailArchive.php

<?php
class user_mailArchive {
    function getFirstChild($content, $conf) {
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                'uid',                         // SELECT ...
                'pages',                       // FROM ...
                'pid='.intval($conf['pid']),   // WHERE...
                '',                            // GROUP BY...
                'sorting',                     // ORDER BY...
                '1'                            // LIMIT ...
            );
        $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
        if ($row) {
            return $row['uid'];
        }
        else {
            return '';
        }
    }
}

TS 模板

# fill the content of the main-column to a tmp.object
tmp.pagecontent < page.10.subparts.main-content

# clear the content of the main column
page.10.subparts.main-content >

includeLibs.mailArchive= fileadmin/userfunc/mailArchive.php

# build a new object for this column as content-object-array
page.10.subparts.main-content = COA
page.10.subparts.main-content {
  10 = CONTENT
  10 {
    table = tt_content
    select {
      pidInList.cObject = USER
      pidInList.cObject {
        userFunc = user_mailArchive->getFirstChild
        # parent page ID
        pid = 139
      }
      orderBy = sorting
    }
  }

# re-insert the normal pagecontent to the page  
  20 < tmp.pagecontent
}

I finally succeed! Not sure though it is the best way. What do you think about it? Should I put the second select into userFunc too?

fileadmin/userfunc/mailArchive.php

<?php
class user_mailArchive {
    function getFirstChild($content, $conf) {
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                'uid',                         // SELECT ...
                'pages',                       // FROM ...
                'pid='.intval($conf['pid']),   // WHERE...
                '',                            // GROUP BY...
                'sorting',                     // ORDER BY...
                '1'                            // LIMIT ...
            );
        $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
        if ($row) {
            return $row['uid'];
        }
        else {
            return '';
        }
    }
}

TS template

# fill the content of the main-column to a tmp.object
tmp.pagecontent < page.10.subparts.main-content

# clear the content of the main column
page.10.subparts.main-content >

includeLibs.mailArchive= fileadmin/userfunc/mailArchive.php

# build a new object for this column as content-object-array
page.10.subparts.main-content = COA
page.10.subparts.main-content {
  10 = CONTENT
  10 {
    table = tt_content
    select {
      pidInList.cObject = USER
      pidInList.cObject {
        userFunc = user_mailArchive->getFirstChild
        # parent page ID
        pid = 139
      }
      orderBy = sorting
    }
  }

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