有一种Page接口的方法可以用来轻松迭代子进程。
我想以递归方式迭代所有后续子节点。
有一个重载方法listChildren(Filter,Boolean)可以做到这一点......如何从这个方法调用这个方法?我的意思是如何修改上面提到的标签以递归方式执行。
你可以定义一个data-sly-template
,它是某种宏,然后用data-sly-call
递归调用它:
<template data-sly-template.descendants="${@ page}">
${page.title}
<ul data-sly-list.child="${page.listChildren}">
<li data-sly-call="${descendants @ page=child}"></li>
</ul>
</template>
<div data-sly-call="${descendants @ page=currentPage}" data-sly-unwrap></div>