Hello,

This the code i test. my_templates derives from web_templates.


<template:containerList id="actusList" displayActionMenu="false">

    <query:containerQuery>
        <query:selector nodeTypeName="my_templates:actusContainer"
selectorName="actusListSelector"/>
        <query:descendantNode selectorName="actusListSelector"
path="${currentSite.JCRPath}"/>
        <query:setProperty name="${queryConstants.SEARCH_MAX_HITS}"
value="${maxActus}" />
        <query:sortBy propertyName="actusDate"
order="${queryConstants.ORDER_DESCENDING}"/>
    </query:containerQuery>

    <c:if test="${empty actusList.size}">
        actusList is empty<br/>
    </c:if>

    SIZE : ${actusList.size}

    <c:if test="${actusList.size > 1}">
                <%@ include
file="../../../containers/actusContent/smallActusDisplay.jspf" %>
    </c:if>
    <c:if test="${actusList.size == 1}">
        <%@ include
file="../../../containers/actusContent/smallOneActuDisplay.jspf" %>
    </c:if>
</template:containerList>

The ouptut :

actusList is empty
SIZE :


Kind regards
Medocs

2009/2/17 Sergiy Shyrkov <my.public.mail...@gmail.com>:
> Hello,
>
>
> the following example shows how to get the size of a container list (no
> matter if it is populated by a query or not - the size property is
> available on  the ContainerListBean instance, exposed into its scope by
> <template:containerList/> tag):
>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
> ...
> <template:containerList name="events" id="eventsContainer"
> actionMenuNamePostFix="events"
>                        actionMenuNameLabelKey="events"
> sortByField="${sortBy}" enforceDefinedSort="true" sortOrder="${order}">
>    <query:containerQuery>
>         <query:selector nodeTypeName="web_templates:eventContainer"
> selectorName="eventsSelector"/>
>        <query:childNode selectorName="eventsSelector"
> path="${eventsContainer.JCRPath}"/>
>            <utility:dateUtil currentDate="${param.startDate}"
> datePattern="dd/MM/yyyy" valueID="today" hours="0"
>                              minutes="0"
>                              seconds="0"/>
>            <query:greaterThanOrEqualTo numberValue="true"
> propertyName="startDate" value="${today.time}"/>
>    </query:containerQuery>
>
>    ...
>    do display it
>    ...
>    We have ${eventsContainer.size}events
>
>    <c:if test="${eventsContainer.size > 1}">
>          we have multiple events
>    </c:if>
>    <c:if test="${eventsContainer.size == 1}">
>          we have a single event
>    </c:if>
>    <c:if test="${eventsContainer.size == 0}">
>          no events at all
>    </c:if>
> </template:containerList>
>
>
> Could you give us, please, the example of code, you are trying to use?
>
> Kind regards
> Sergiy
>
> MesDocs ParMail wrote:
>> Hi,
>>
>> I'd like to retrieve the size of a containerList populated by a query.
>> My page  will have different rendering if the result size is 1 or
>> more.
>>
>> I have tested (and printed) the size attribute of the containerList
>> tag but it seemed to be empty.
>>
>> How can I get this information ?
>>
>> Thanks.
>>
>> Mesdocs.
>> _______________________________________________
>> template_list mailing list
>> template_list@jahia.org
>> http://lists.jahia.org/cgi-bin/mailman/listinfo/template_list
>>
>
> _______________________________________________
> template_list mailing list
> template_list@jahia.org
> http://lists.jahia.org/cgi-bin/mailman/listinfo/template_list
>
_______________________________________________
template_list mailing list
template_list@jahia.org
http://lists.jahia.org/cgi-bin/mailman/listinfo/template_list

Reply via email to