Render ContentCollection in ContentCollection

Hi,
is it possible, to render Content of one Content-Collection in other ContentCollection?
I would like to do something like this:

body {
		templatePath = 'resource://Vendor.Site/Private/Templates/Page/Default.html'
		sectionName = 'body'
		parts {
			menu = Menu
			footerMenu = FooterMenu
		}		
		content {
			// Header section
			header = ContentCollection {
				nodePath = 'header'
			}
			// The default content section
			main = PrimaryContent {				
				nodePath = 'main'
			}
			// Footer section
			footer = ContentCollection {
				nodePath = 'footer'
			}
		}		
	}
<body>
    <div{content.main.default.renderer.attributes -> f:format.raw()}>
        <!-- Header -->
        <f:if condition="{content.header}">{content.header -> f:format.raw()}</f:if>
        <!-- Main -->
        {content.main.onlyContent -> f:format.raw()}
        <!-- Footer -->
        <section class="footer">
            <f:if condition="{content.footer}">{content.footer -> f:format.raw()}</f:if>
            {parts.footerMenu -> f:format.raw()}
        </section>
    </div>
<body>

Would be glad, if someone could point me to a working example/docu/possible viewHelper or so.

I don’t know what you are trying to do there?

Why would you apply the atrtibutes of content.main to the layout div instead of directly putting them in the template or definining them separately in TypoScript for body?

Also the if condition around content.header and content.footer won’t do you much good I guess.

I would like to nested the content-Collections in the Frontend-SourceCode and only output what is filled with content. There’s probably a much simpler solution for, I guess.

Explanation of my intention:
In Backend, the structure looks like this:

Now the sourceCode is:

<div class="neos-content-collection" role="banner">
	//content from Content Collection (header) 		
</div>
<div class="neos-content-collection" role="main">	
	//content from Content Collection (main)	
</div>
<div class="neos-content-collection" role="content-info">
	//content from Content Collection (footer)
</div>

… no matter whether something is in the collections or not.


I would like to nested the header and footer into the main-content Tag and suppress header-tag||footer-tag if these are empty:
So, the sourceCode would be more compact and the structure more html5-like, but the Backend would remain clear and easy to fill.

# with main, header-content and footer-content.
<div class="neos-content-collection" role="main">
	<div class="neos-content-collection" role="banner">
		//content from Content Collection (header) 		
	</div>	
	//content from Content Collection (main)	
	<div class="neos-content-collection" role="content-ifno">
		//content from Content Collection (footer) 		
	</div>	
</div>

— or —

# with main, header-content but NO footer-content.
<div class="neos-content-collection" role="main">
	<div class="neos-content-collection" role="banner">
		//content from Content Collection (header) 		
	</div>	
	//content from Content Collection (main)	
</div>

— or —

# with main, NO header-content BUT footer-content.
<div class="neos-content-collection" role="main">		
	//content from Content Collection (main)	
	<div class="neos-content-collection" role="content-ifno">
		//content from Content Collection (footer) 		
	</div>	
</div>

— or —

# with main, NO header-content NO footer-content.
<div class="neos-content-collection" role="main">	
	//content from Content Collection (main)		
</div>

Hope this will explain what I’m trying to. It also works the way it is, but I’m interested in whether I could optimize the SourceCode in the desired direction.

[quote=“christianm, post:2, topic:1159”]
instead of directly putting them in the template or definining them separately in TypoScript for body
[/quote] Sorry, but I can’t see the solution for my intention. Maybe you know an online example of:

  • putting them in the template and break-open the parts of the contentCollection (attributes/content-value/…)?
  • defining them sepeately in TypoScript for body?

Maybe you or someone else knows a link to various templates or structural ideas to expand my horizon or find a solution.

Thank you very much for your help so far