[Neos] Help with some typoscript

Nick nick at jamalade.com
Tue Feb 4 13:52:51 CET 2014


Hi all

I am trying to implement a teaser nodetype which I have called SectionTeaser which can be used to create a teaser element for a Section.
The idea would be that the editor inserts a SectionTeaser and then selects a node of type Section. Then I want to grab the Section and display the 
sections Headline, if it exists, and say the first 400 characters of the section's first text element.
I have defined:
Reroot.RerootSiteCom:Section to be a subtype of TYPO3.Neos:Content and have childNodes column0 with type TYPO3.Neos:Content.
Reroot.RerootSiteCom:SectionTeaser is a subtype of TYPO3.Neos:Content and has one property teaserTargetNode type reference with an editor option 
nodetypes : Reroot.RerootSiteCom:Section.


When it comes to the TypoScript I seem to be getting nowhere, which is probably a reflection of my knowledge :(

I had hoped in SectionTeaser.ts2 to try something like this:

prototype(Reroot.RerootSiteCom:SectionTeaser) < prototype(TYPO3.Neos:Content){
     templatePath = 'resource://Reroot.RerootSiteCom/Private/Templates/NodeTypes/SectionTeaser.html'

     // get the Target Node for this teaser
     teaserTargetNode = ${q(node).property('teaserTargetNode')}

     //search for the first (there could be more than one ) TYPO3.Neos.NodeTypes:Headline contend in the childNode 'column0'
     teaserHeadline = ${q(teaserTargetNode).children('column0').children('[instanceof TYPO3.Neos.NodeTypes:Headline]').first().get(0)}

     //grab the first 400 chars of the first TYPO3.Neos.NodeTypes:Text contained in the Section
     teaserText= ${q(teaserTargetNode).children('column0').children('[instanceof TYPO3.Neos.NodeTypes:Text]').first().slice(0,400)}
}

I would then render teaserHeadline and teaserHeadline in the SectionTeaser.html

However they are always empty.

Any pointers would be gratefully appreciated

Best wishes

Nick




More information about the Neos mailing list