3
votes

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
2
Are using Templavoila? you could reference the items.konsolenfreddy
No. I use the Template Auto-parser. I cannot simply reference the items, because what I want is content of the first subpage, and the first subpage can change in time, when I add new pages. So it's not always the same items I want to display.Charles Brunet
"select" behaves like a SQL query. Look at the last example with pidInList here wiki.typo3.org/TSref/CONTENT Using RECORDS instead of CONTENT may be more suitable for your case. wiki.typo3.org/TSref/RECORDSRito

2 Answers

3
votes

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 = |
      }
    }
  }
}
-1
votes

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
}