Search

Hi

I've been asked by a client to create a most tweeted posts widget for his blog. I'm still wondering what is the best way of doing this.

I know that with the twitter api I can get the number of times in url has been tweeted. For example:

http://urls.api.twitter.com/1/urls/count.json?url=getsymphony.com

But in order to work out the 3 most popular posts I will need to know who many times each blog post has been tweeted and presumably store this value in the blog section so that I can create a datasource for the top 3 most popular posts.

I would also need a way of keeping this stored value up to date so I guess I would need a cron job working every hour or so to refresh these values.

The nitty gritty of how to do this I am still not sure on. Would I need some kind of custom event/datasource?

Or am I making this over complicated?

Any help/advice on this would be great.

Hi Dave,

Whilst not a direct answer in regards to a Symphony implementation, have you considered looking at Addthis as a means to track social links etc?

Here are a couple of links to get you started:

@davecoggins, being most popular they would get plenty of views I presume; so I would only update on page-load for the current page (get from the twitter API) using a standard data-source.

Then what I would do is the following; Create an extension which has a post-datasource delegate check if the data-source name matches with the one you created; extract the value (tweets) and page id of the page & store them into a table somewhere (can be custom). If you have too many views you can always say to run the update not sooner then every x minutes

Finally create a custom datasource (unless you stored these into a symphony section) which would pull up the page-ids & number of tweets. Importantly I would also output the ID as a datasource parameter. So then you could link this up to a normal data-source and pull up the entry details as required.

I might be over complicating this but its the first thing that would come to mind. You could always replace the first step with a cron-job but I would presume you'd have to run it on every-article.

Thank you both for your quick replies. I'll take a look into them today. I think the addthis implementation could be the easiest way to go.

Thanks again

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