Nils Breunese wrote:
I'd like to use the ?ancestors FreeMarker built-in. I put this in a
FreeMarker template:
----
[#assign ancs = content?ancestors]
----
Just adding that assignment throws the following error when accessing
the page:
----
Can't get parent of I18nContentWrapper for website:/[rep:root]:root node
doesn't have a parent
----
Am I doing something wrong or is this a bug? I'm using Magnolia 4.1.1 EE.
I tried to work around using ?ancestors by using ?parent in a list loop,
but I ran into the exact same error message trying to do that. My goal
is to get a reference to the home node for an arbitrary page.
Since ?ancestors is giving me an error, I tried this as a workaround:
----
[#-- Find the home node --]
[#assign current = content]
[#assign home = current]
[#list 1..100 as level]
[#assign current = current?parent]
[#if current?parent??]
[#assign home = current]
[#else]
[#break]
[/#if]
[/#list]
----
This gives me the same FreeMarker template error I get when I try to use
?ancestors:
----
Can't get parent of I18nContentWrapper for website:/[rep:root]:root node
doesn't have a parent
----
The error is on the line where current?parent?? is checked. According to
the FreeMarker documentation for the ?parent built-in [0] node?parent??
should evaluate to false for the root node, but all I'm getting is this
I18nContentWrapper error. :(
Is the ?ancestors built-in working for anybody else? Does anyone know
how I can get this work?
Nils Breunese.
[0]
http://freemarker.sourceforge.net/docs/ref_builtins_node.html#ref_builtin_parent
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------