[Neos] Help with some typoscript

Nick nick at jamalade.com
Wed Feb 5 11:56:46 CET 2014


Hi all

I could still do with a bit of help on this as I am wondering if what I am trying to do is possible at all now!

I thought as I was having no luck traversing the children of the teaserTarget node I would try getting a parent node. ie.

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

in fluid I do a simple dump of the above ie. {teaserTargetNode} & {teaserTargetNodeParent}
for
{teaserTargetNode} i get :
Node /sites/rerootsitecom/what-we-do/for-you/main/node52e907b4a56fe[Reroot.RerootSiteCom:Section]
{teaserTargetNodeParent} is null .

So clealry I can't traverse this nodes parents or children. Is this expected behaviour or a bug? From my limited understanding it would seem a useful 
feature to have. All help welcome please :)

Best wishes

Nick


On 04/02/2014 12:52, Nick wrote:
> 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