Hi Martin
I am not quite sure if I understood everything correctly. I am just
focusing on "how many paragraphs".
What you can do is use the Magnolia API:
int size = contentPage.getChildren(ItemType.CONTENTNODE).size();
or, which actually is the same:
int size = contentPage.getChildren("mgnl:contentnode").size();
While a page is of node type "mgnl:content", a paragraph (although
also a node) is of node type "mgnl:contentnode", so the method returns
a "Collection" of paragraph nodes.
Is that what you are looking for?
Cheers
/giancarlo
On Nov 30, 2008, at 9:49 AM, Martin Algesten wrote:
Thanks Rainer,
But that's not what I want. varStatus only works when you're looping
- i was hoping to know the size of that list of children without
actually counting them one by one. Sure I have a temporary solution
in place that is doing just that right now - but it feels wrong.
The magnolia API doesn't seem to get me anywhere - I may be mixed
up, but I don't think I'm counting child nodes, when I count
paragraphs, but rather a several instanced property on a node.
The mystery remains - how do I know how many paragraphs I have?
Martin
On 30 Nov 2008, at 17:47, rainer wrote:
hi,
maybe you are looking for the varStatus attribute?
this is an example...
<c:forEach items="${roleGp.rolesInGroup}" var="roleName"
varStatus="i">
<td><c:out value="${roleGp.valRange[${i.getCount}]}"/></td></tr>
</c:forEach>
As far as i remember there are a couple of informations availbale
on that
attribute...
You could also use the Magnl API to collect all the children of the
parent
node of your images ;)
regards
rainer
Martin Algesten wrote:
First off a great big THANKS! for this software. So far I've been
extremely productive in setting up templates and getting everything
"just right" - not many surprises at all despite the complexity of
the
domain.
And now to a simple one...
I'm tearing my hair out here: How do I count the number of
paragraphs?
I have a page I call an "image collection". Each image is added as a
paragraph. Now I want to randomise which image to show - but how
do I
know how many images I have? How do I count the paragraphs?
M
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
----------------------------------------------------------------
--
View this message in context:
http://www.nabble.com/count-paragraphs-tp20738681p20759301.html
Sent from the Magnolia - User mailing list archive at Nabble.com.
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
----------------------------------------------------------------