tade
(Daniel Toth)
#1
I added a new attribute to page: pageType
I can access this attribute fine from the page template using this:
{node.properties.pageType}
but not from BodyScripts.html:
<f:section name="commonBodyScripts">
{node.properties.pageType}
</f:section>
Root.fusion:
...
body {
sectionName = 'body'
javascripts.site = Neos.Fusion:Template {
sectionName = 'bodyScripts'
commonBodyScripts = Neos.Fusion:Template {
templatePath = 'resource://vendor.site/Private/Templates/Include/BodyScripts.html'
sectionName = 'commonBodyScripts'
}
}
}
Can you please help me how could I access page attributes from those included sections?
Thank you,
Daniel
ilCerchiari
(nicola Cerchiari)
#2
Hi @tade,
have you tried with something like this?
commonBodyScripts = Neos.Fusion:Template {
templatePath = 'resource://vendor.site/Private/Templates/Include/BodyScripts.html'
sectionName = 'commonBodyScripts'
propertyToImport = ${q(node).property('pageType')}
}
and then in your BodyScirpts.html you call {propertyToImport}
.
Did not try it but as a first attempt, reading straight from docs
Hope it helps,
Nicola
tade
(Daniel Toth)
#3
It works!!! Thank you very much and I apologize for my not finding it in the docs, you’re right it’s clearly there.
ilCerchiari
(nicola Cerchiari)
#4
No problem at all man, that’s the way we all learn… 