Typo3: отображать содержимое с первой подстраницы, используя Typoscript - PullRequest
3 голосов
/ 04 июня 2011

Это то, что я хочу сделать: на данной странице я хочу отобразить все элементы содержимого первой дочерней страницы данной страницы.Я не могу просто использовать страницу быстрого доступа, потому что мне нужно отображать другие элементы контента после тех, что на подстранице.Как я могу это сделать?

Вот фрагмент того, как, я думаю, я мог бы это сделать, но я не знаю, как создать селект.Есть ли лучший способ?

# 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

Ответы [ 2 ]

3 голосов
/ 14 июня 2013

Просто добавьте ответ для других людей. Первый: укажите первую подстраницу текущей страницы. Второе: получите нужные вам элементы контента этой подстраницы.

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 = |
      }
    }
  }
}
0 голосов
/ 17 июня 2011

У меня наконец получилось! Не уверен, хотя это лучший способ. Что вы думаете об этом? Должен ли я поместить второй выбор в 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
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...