AnsweredAssumed Answered

template variables

Question asked by alpha on Mar 21, 2007
Latest reply on Mar 23, 2007 by alpha
Hi guys!

I have a custom.jsp in which i call a template

<r:template id="template" template="alfresco/templates/custom.ftl"/>

and here is the code for custom.ftl
   <#list space.children as child>
      <#if child.isDocument>
             <td><img src="/alfresco${child.icon16}"></td>
             <#assign ref=child.nodeRef>
             <#assign workspace=ref[0..ref?index_of("://")-1]>
             <#assign storenode=ref[ref?index_of("://")+3..]>
             <td><a href="/alfresco/navigate/showDocumentDetails/${workspace}/${storenode}"><b>${}</b></a> (${child.children?size})</td>
the code is nearly similar to my_spaces.ftl

if i call the JSP, i have an error saying that variables space is not defined :
Caused by: freemarker.core.InvalidReferenceException: Expression space is undefi
ned on line 4, column 11 in alfresco/templates/custom.ftl.
        at freemarker.core.TemplateObject.assertNonNull(

        at freemarker.core.TemplateObject.invalidTypeException(
        at freemarker.core.Dot._getAsTemplateModel(
        at freemarker.core.Expression.getAsTemplateModel(
        at freemarker.core.IteratorBlock.accept(
        at freemarker.core.Environment.visit(
        at freemarker.core.MixedContent.accept(
        at freemarker.core.Environment.visit(
        at freemarker.core.Environment.process(
        at freemarker.template.Template.process(
        at org.alfresco.repo.template.FreeMarkerProcessor.process(
        … 61 more

I have read in the wiki (

If you are accessing the templates through the Space Preview action, the Template Servlet or through the Space Dashboard then the following named object is also provided:

    The current space template node.

how can i get the current node ?
please give me a hint

thanks in advance