The query for most of us would be
/jcr:root//element(*, mgnl:content)
something like:
public String getPageCount() {
try {
HierarchyManager hierarchyManager =
MgnlContext.getHierarchyManager(ContentRepository.WEBSITE);
QueryManager queryManager = hierarchyManager.getQueryManager();
Query query = queryManager.createQuery("/jcr:root//element(*,
mgnl:content)", "xpath");
Collection content = query.execute().getContent();
int i = content.size();
return Integer.toString(i);
} catch (InvalidQueryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RepositoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "unknown";
}
Am 03.07.2007 um 21:21 schrieb Ben Brock:
Thanks everyone. Sean's example worked great.
It might be worth adding the means to find the total via a database
query to the Wiki page if you know the statement, Gregory.
Ben Brock
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
Sent: 03 July 2007 18:07
To: [email protected]
Subject: Re: [magnolia-user] How to get total number of pages
We wrote a little JSP script to recurse though the site and compile
this
data for us. Details are here:
http://www.magnolia.info/wiki/Wiki.jsp?page=CountingPages
Hope that helps!
Sean
On 7/3/07 11:00 AM, "Ben Brock" <[email protected]> wrote:
Thanks for the reply, Niko.
I'd be happy with either the number of activated pages or the number
of visible pages.
I did a search within Magnolia Central and no totals are displayed. I
do not have search implemented on my site.
How can I programmatically get the total number of pages?
Ben Brock
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
Sent: 03 July 2007 00:48
To: [email protected]
Subject: Re: [magnolia-user] How to get total number of pages
Hi Ben,
Did you mean the number of activated pages ? the number of visible
pages ?
I would say the best way would be to execute a search on the
repository.
Niko,
On Jul 3, 2007, at 3:58 AM, Ben Brock wrote:
What's the easiest way for me to retrieve the total number of pages
on
our site?
Ben Brock
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------