【问题标题】:Alfresco unordered list web scriptAlfresco 无序列表网页脚本
【发布时间】:2011-05-21 03:03:47
【问题描述】:

我需要从一个 Alfresco Space 开始构建一个无序列表:

我找到了这个工作模板:

 <#macro recurse_macro node depth>
  <#if node.isContainer>
    <tr>
 <td align='left'>(${depth}) 
    <#if (depth>0) >
   <#list 1..depth as i>.</#list> 
    </#if>
  <img src="/alfresco${node.icon16}"> <a href="/alfresco${node.url}">${node.properties.name}</a>
 </td>
  </tr>

   <#list node.children as child>
 <#if child.isContainer && node.children?size != 0 >
   <@recurse_macro node=child depth=depth+1/>
 </#if>
   </#list>
  </#if>
</#macro>

<b>Recursive Listing of Spaces:</b>
<table border="1" celpadding="1" cellspacing="1">
<tr><th> Name Space </th></tr>
<@recurse_macro node=companyhome depth=0/>
</table>

我需要修改这个模板,将空间内容呈现为无序列表:

<ul id="0" >
    <li id="1">Content_one
    <ul>
       <li id="2">Content_two
    <ul>
   <li id="3">Content_three</li>
      <li id="4">Content_four</li>
     </ul>
       </li>
       <li id="5">Content_five</li>
    </ul>
    </li> 
</ul>

任何帮助将不胜感激。

谢谢

【问题讨论】:

    标签: freemarker alfresco


    【解决方案1】:

    好吧,您需要在列出节点的任何地方添加一个

  • 标记,例如: 先用
    替换table标签。

    然后,在#macro - 您需要列出内容名称,但没有

    部分。所以删除 和 标签。此外,您不需要这些点,因此请删除 0) > 块。

    你需要一个计数器。所以在你第一次进入递归宏之前有一个 />

    您还需要在您的实际文档名称所在的行周围添加

  • 标签。 所以将 和 块括在
  • 中并用
  • 关闭它

    现在,当你进行递归时,你还需要一组新的

      标签。 为此,您需要更改
    #if child.isContainer && node.children?size != 0 >
       <@recurse_macro node=child depth=depth+1/>
     </#if>
    

    块。用 和 标签将标签括起来。

    应该可以的。

    【讨论】:

    • 但是,我建议在服务器端 javascript 中结合 freemarker 重写,渲染应该明显更快
    猜你喜欢
    • 1970-01-01
    • 2015-12-16
    • 2012-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-13
    相关资源
    最近更新 更多