Search

I'm using Symphony for a podcast website. Episode info is stored in Symphony and the media files are stored with a third party hosting service. This service provides download statistics and I would like to use these to display the Top N downloaded episodes (for the current month and of all time) on the site. I need some kind of Datasource for the downloads data but I'm not sure how best to set it up.

Things a downloads Datasource would need:

  • Output Parameters: the hosting service only has episode numbers. I need to get the rest of the episode info from a Symphony Section, ideally via Datasource chaining
  • Caching: download stats should only be queried once a day
  • Pagination and sorting: ideally these would be editable in the admin without requiring code changes

Approaches I have considered:

  1. A customised Dynamic XML Datasource. It has caching for free and I could use URL parameters for pagination and sorting. Presumably I could add whatever output parameters I needed to the param pool but would the dependencies work? Is it possible to force an XML DS to run before a Section DS?

  2. A customised Section Data Source. Has output parameters, sorting and pagination built in - potential for leveraging the existing Symphony codebase. Integration could be quite complex though and I would need a dummy Symphony Section. Also lacks caching (e.g. would need to use the Cacheable DS extension or similar).

Other ideas:

  1. Forget Datasource chaining. Instead write a custom Datasource that queries the third party service and Symphony, combines the data internally and returns the result. Technically simpler but a lot less flexible.

  2. Forget custom Datasources. Instead use a custom event to populate a Symphony Section with the downloads data. This Section could then be queried/chained in the normal way.

Any comments on the best approach? None of these are particularly elegant solutions. Maybe I'm missing something obvious.

A customised Dynamic XML datasource is your best bet. So long as you add the parameter to the parameter pool using the usual naming convention ($ds-handle.param), when you use this parameter in your other datasource the dependencies should resolve automatically.

Thanks for the response - I'll try that first.

I've just been reading about Providers and think that extracting the code into its own extension could be worthwhile. I could add pagination and sorting options to the admin screen instead of relying on URL parameters. And others might find a Datasource that pulls in Libsyn download stats useful. Would output parameters/dependencies work the same way in this scenario?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details