Search

Hi guys! Anybody help me ..can i get twitter followers count and feedburner readers?

Twitter followers: yes.

Create a new Dynamic XML Data Source and use a URL such as:

http://api.twitter.com/1/statuses/followers/nickdunn.xml

(Replacing your username in the URL).

This feed from the Twitter API returns all followers for a user. You’ll need to make sure your account isn’t private/protected. With XSLT you can then count the number of <user> elements:

<xsl:value-of select="count(my-dynamic-ds//user)"/>

You might be able to do a similar thing for Feedburner but I don’t know much about their API.

Thanks very much Nick!

Hmm… count shows 0 followers. I create Dynamic XML Data Source “twitter count” with URL

http://api.twitter.com/1/statuses/followers/minorukun.xml

and add this line to master.xsl:

<xsl:value-of select="count(twitter-count//user)"/>

What is the problem?

Debug your page by appending ?debug to the URL. Do you see the contents of your twitter-count as a list of users?

no i can’t see, but when i add to page DS “Twitter count”, i see my twitter xml file, and followers count still show 0

If you have attached the Data Source to your page, it should work!
Anyway if you want a complete list of your followers, you should use this as a source;

http://api.twitter.com/1/followers/ids/your_screen_name.xml

and then:

<xsl:value-of select="count(twitter-count//id)"/>

yes data source attached, but did’t work… maybe, because i use symphony 2.0.6?

No, all recent Symphony versions will do fine.

Can you post your XML and XSLT to pastie.org?

XSLT - http://pastie.org/901698 XML - http://pastie.org/901699

Ah right… my first guess would be

<xsl:value-of select="count(data/twitter-count//id)"/>

If that doesn’t work try a

<xsl:copy-of select="data/twitter-count" />

to see if the twitter-count element is where you expect it to be.

Oh, nice, that works. Thx you guys.

The problem was as following:

We assumed you would follow a technique we all are acustomed to: The first step is to create a Utility, called master.xsl. In this utility you have the root template <xsl:template match="/" />

You then go ahead and create your Pages, including that master.xsl and defining a data template <xsl:template match="data" /> effectively outsourcing the whole HTML frame (the header and a couple of divs for your CSS) and only generating the actual content in your Page.

So we assumed you were talking about something not working within your <xsl:template match="data" />, making the current node /data when in fact it was just /. So yeah, in the end you had to make clear that you meant <twitter-count /> that’s inside <data />. Hope that clarifies things a bit for you.

As you can see from your simple example, there are numerous ways of achieving your goal in XSLT. You just have to get good at picking the one that suits you most. :-)

Thanks for the clarification, i think, i figured this. I some changed my twiiter followers count)) Then DS “twitter count” with url:

http://twitter.com/users/show.xml?screen_name=minorukun

and XSLT:

<xsl:for-each select="data/twitter-count/user">
 <xsl:value-of select="followers_count"/>
 </xsl:for-each>

I think the for-each isn’t necessary there.

<xsl:value-of select="data/twitter-count/user/followers_count" />

should suffice (assuming that there is only one person in the feed)

Yes you’re right

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