2

ハイパーリンクされたリストとして表示するすべての子ページのリストを作成しようとしています。ユーザーに親フォルダーを選択してもらい、それに応じて子ページを一覧表示する必要があります。ただし、空白(children空)になっています。

ダイアログ要素:

<listRoot
  name (String): ./listRoot
  jcr:primaryType (Name): cq:Widget
  xtype (String): pathfield
>

ソースコード:

<%@include file="/libs/foundation/global.jsp"%>
<%@page
import="java.util.Iterator,
        com.day.cq.wcm.api.PageFilter"
%>
<%@page session="false" %>

<%
    String listroot = properties.get("listRoot", currentPage.getPath());
    Page rootPage = pageManager.getPage(listroot);
    if (rootPage != null) {
        Iterator<Page> children = rootPage.listChildren(new PageFilter(request));
        while (children.hasNext()) {
            Page child = children.next();
            String title = child.getTitle() == null ? child.getName() : child.getTitle();
            String date = child.getProperties().get("date","");
            %><div class="item">
            <a href="<%= child.getPath() %>.html"><b><%= title %></b></a>
            <span><%= date %></span><br>
            <%= child.getProperties().get("jcr:description","") %><br>
            </div><%
        }
    }
%>
4

1 に答える 1

0

子ページがナビゲーションから非表示になっているかどうかを確認できますか(ページのプロパティで「ナビゲーションに非表示」プロパティが選択されているはずです)。

新しいPageFilter(request)を使用すると、すべての非表示ページが除外されるためです。

それ以外の場合、このコードは私にとっては問題なく実行されます。

よろしく、Rakesh

于 2013-03-11T16:38:50.923 に答える