Mario Martínez Campos (via Magnolia Forums)
2012-10-19 12:42:51 UTC
Hi! I am quite new in magnolia. I have the following problem. I have a ftl script with this content:
[code]
[#if model.sections?has_content]
[#list model.sections as item]
<li><a href="${cmsfn.link(item)}">${item.title!'section'}</a></li>
[#assign children = model.subSection(item)]
.......MORE CODE HERE...
[/#list]
[/#if]
[/code]
and a model class with these functions:
[code]
public Collection<ContentMap> getSections() throws RepositoryException{
Collection<Node> sections = new ArrayList<Node> ();
Node root = this.getSiteRoot();
if(this.isShowInNav(root)){
sections.add(root);
}
NodeIterator it = root.getNodes();
while(it.hasNext()){
Node n = it.nextNode();
if(this.isShowInNav(n)){
sections.add(n);
}
}
return templatingFunction.asContentMapList(sections);
}
public Collection<ContentMap> getSubSections(ContentMap contentMap) {
return getSubSections(templatingFunction.asJCRNode(contentMap));
}
public Collection<ContentMap> getSubSections(Node node) {
Collection<Node> sections = new ArrayList<Node> ();
NodeIterator it;
try {
it = node.getNodes();
while(it.hasNext()){
Node n = it.nextNode();
if(this.isShowInNav(n)){
sections.add(n);
}
}
} catch (RepositoryException e) {
e.printStackTrace();
return new ArrayList<ContentMap>();
}
return templatingFunction.asContentMapList(sections);
}
[/code]
When I am using [b]model.sections[/b], everything is OK, but when I try to use [b]model.subSection(item)[/b] I get these annoying yellow page with the text
[code]Expression model.subSection is undefined on line 14, column 71 in tangent90/templates/global/header.ftl.
The problematic instruction:
----------
==> assignment: children=model.subSection(item) [on line 14, column 51 in tangent90/templates/global/header.ftl]
in include "/tangent90/templates/global/header.ftl" [on line 6, column 1 in tangent90/templates/home.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression model.subSection is undefined on line 14, column 71 in tangent90/templates/global/header.ftl.
.....[/code]
I have checked that is not problem with the java code because it never been executed and I tried with "model.getSubSection(item)", "model.subsection(item)",etc....
Any help??
Thanks!
[code]
[#if model.sections?has_content]
[#list model.sections as item]
<li><a href="${cmsfn.link(item)}">${item.title!'section'}</a></li>
[#assign children = model.subSection(item)]
.......MORE CODE HERE...
[/#list]
[/#if]
[/code]
and a model class with these functions:
[code]
public Collection<ContentMap> getSections() throws RepositoryException{
Collection<Node> sections = new ArrayList<Node> ();
Node root = this.getSiteRoot();
if(this.isShowInNav(root)){
sections.add(root);
}
NodeIterator it = root.getNodes();
while(it.hasNext()){
Node n = it.nextNode();
if(this.isShowInNav(n)){
sections.add(n);
}
}
return templatingFunction.asContentMapList(sections);
}
public Collection<ContentMap> getSubSections(ContentMap contentMap) {
return getSubSections(templatingFunction.asJCRNode(contentMap));
}
public Collection<ContentMap> getSubSections(Node node) {
Collection<Node> sections = new ArrayList<Node> ();
NodeIterator it;
try {
it = node.getNodes();
while(it.hasNext()){
Node n = it.nextNode();
if(this.isShowInNav(n)){
sections.add(n);
}
}
} catch (RepositoryException e) {
e.printStackTrace();
return new ArrayList<ContentMap>();
}
return templatingFunction.asContentMapList(sections);
}
[/code]
When I am using [b]model.sections[/b], everything is OK, but when I try to use [b]model.subSection(item)[/b] I get these annoying yellow page with the text
[code]Expression model.subSection is undefined on line 14, column 71 in tangent90/templates/global/header.ftl.
The problematic instruction:
----------
==> assignment: children=model.subSection(item) [on line 14, column 51 in tangent90/templates/global/header.ftl]
in include "/tangent90/templates/global/header.ftl" [on line 6, column 1 in tangent90/templates/home.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression model.subSection is undefined on line 14, column 71 in tangent90/templates/global/header.ftl.
.....[/code]
I have checked that is not problem with the java code because it never been executed and I tried with "model.getSubSection(item)", "model.subsection(item)",etc....
Any help??
Thanks!
--
Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=d8b2fc0f-e371-43c0-8444-e0ddf6d3bf88
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <user-list-***@magnolia-cms.com>
----------------------------------------------------------------
Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=d8b2fc0f-e371-43c0-8444-e0ddf6d3bf88
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <user-list-***@magnolia-cms.com>
----------------------------------------------------------------