2 users online. Create an account or sign in to join them.Users

Search

Hi all,

I’m trying to figure out the optimal solution to get stats about content in sections. I’m using XML Importer to bring in lots of content, and I want to output simple statistics such as the number of entries dated within the current year.

My current solution is to dump the content out with a data source and then use the XPath count() function to obtain the number of entries. There are a few problems with this approach:

  1. you have to arbitrarily limit the number of items output by the data source
  2. performance-wise it seems inelegant to pass large numbers of entries into the XML for processing
  3. I haven’t been able to figure out a date filter parameter to give me the equivalent of “later than last year”. Currently hardcoded “later than 2009-12-31” as a workaround.

any suggestions would be greatly appreciated, thanks in advance!

  1. Try just including the pagination in your output, you can use the total-entries to get all the entries that match your filter.
  2. Agreed, that’s why you’ll just output the pagination
  3. later than last year should work. It’s a little known secret that whatever you filter on data fields is uses strtotime in the backend

You can also use the Global Parameter Loader extension to add parameters to Symphony’s parameter pool for datasource filtering.

OK, that is fantastic. I knew there had to be a far more elegant (and obvious) solution…never had a reason to use pagination up to this point. Thanks a bunch!

Re: the date, I tried later than last year and it returned everything, not just the stuff from 2010. If I use later than 2009-12-31 it works. I agree that this is supported by PHP’s strtotime though, so I can’t imagine why it wouldn’t work…

One more question: I need to do some analysis on the content in all entries in a section, such as the number of occurrences of a specific word in a text input field. Is there a sneaky way to do something like this without resorting to processing it all with XSL?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details