Typo3 Show Content from Subpages Inlcuding CSS Classes

Typo3: display content from first sub-page using typoscript

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
}

TYPO3: How do I insert page content from parent page into subpages

I think, you want to use Content Slide

For the same within TemplaVoilà take a look at KB TV Content Slide ext

Typo3 create reference element for all subpages

Both approaches are suboptimal, since you either had to create a reference content record on each page or your plugin would not be configured manually anymore.

My recommendation would be to put that particular plugin into a specific column of the root page and inherit the content of that column via the "slide" feature of the CONTENT cObject:

https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Content/Index.html#slide

We are using this feature i.e. for the whole footer section of https://coders.care including the twitter plugin and the random testimonial content.

TYPO3: Show content from a fixed page if there’s no content on current page

Thanks for answer but I couldn't get it to work. Instead this worked:

lib.rightCol-1 = CONTENT
lib.rightCol-1 < styles.content.get
lib.rightCol-1.select.where = colPos=31
lib.rightCol-1 {
stdWrap.ifEmpty.cObject = CONTENT
stdWrap.ifEmpty.cObject {
table = tt_content
select {
pidInList = 58
orderBy = sorting
where = colPos = 31
languageField = sys_language_uid
}
}
}

Typo3 Single Page content rendering

Adding contents of the subpages works with this TypoScript. You need to put another CONTENT in first renderObj.

lib.onepage {
20 = CONTENT
20 {
table = pages
select.orderBy = sorting
renderObj = COA
renderObj {
10 = CONTENT
10 {
table = tt_content
select {
pidInList.field = uid
orderBy = sorting
where = colPos = 0
}
wrap = <section id="{field:css_id}" class="{field:css_class}">|</section>
wrap.insertData = 1
}
20 = CONTENT
20 {
table = pages
select {
orderBy = sorting
pidInList.field = uid
}
renderObj = COA
renderObj {
10 = CONTENT
10 {
table = tt_content
select {
pidInList.field = uid
orderBy = sorting
where = colPos = 0
}
wrap = <section id="{field:css_id}" class="{field:css_class}">|</section>
wrap.insertData = 1
}
}
wrap = <main role="main">|</main>
}
}
}

Typo3 - TMENU get Content from Colpos

Here is my Solution

lib.mainmenu = HMENU 
lib.mainmenu {
1 = TMENU
1 {
wrap = <ul id="mainmenu">|</ul>
expAll = 1
NO {
wrapItemAndSub = <li>|</div></li>
ATagParams = class="drop"
}
submenuObjSuffixes = a || b || c || d || e
}
2a < .1
2a {
wrap = <div class="dropdown_produkte">|</div>
stdWrap.cObject = COA
stdWrap.cObject {

20 = HMENU
20 {
special = directory
special.value.data = field:pid

1 = TMENU
1 {
expAll = 1
wrap = <div class="nav-tabs"><ul>|</ul>

NO {
wrapItemAndSub = <li>|</li>
#stdWrap.dataWrap = <h2>|</h2>
#linkWrap = | |*|  / 
ATagParams = class=submenu
}
ACT < .NO
ACT = 1
ACT {
ATagParams = class=submenuActive
}
RO < .ACT
}
}

40 = CONTENT
40 {
table = pages
select {
pidInList.field = pid
orderBy = sorting
}

renderObj = COA_INT
renderObj {
10 = TEXT
#10.field = title
10.wrap = |
20 = LOAD_REGISTER
20 {
meinRegister.cObject = TEXT
meinRegister.cObject.field = uid
}

50 = COA
50 {
###########
20 = CONTENT
20 {
table = tt_content
select {
pidInList.data = register:meinRegister
where = colPos=0
}
}
###########
}
}
}

}
}
}


Related Topics



Leave a reply



Submit