PDA

View Full Version : Blog feed tutorial (getting-started) question



chocyau2000
5 Feb 2014, 12:15 AM
Hi guys

I am looking at the source code of this example to learn a bit about sencha handling blog feeds and am wondering what would i need to change in the code to get more than 4 results from the RSS feed. A feed i am hitting as an example has about 20 responses but the example is only showing 4

Cheers

saJoshua
5 Feb 2014, 5:39 AM
I'm pretty sure we could be of more help if you supply some more information, like the URL of the example you're referring to and some source code to see what you've tried?

chocyau2000
5 Feb 2014, 4:21 PM
Hi

its the example which ships with the sencha touch sdk. It can be found in /examples/getting-started

i have been reading through the app.js code to see where its determining that only 4 entries are shown and cannot figure that bit out.

the rest i have deciphered and have changed a few things with success (to test out theories i had about how the code was working). I am in the early learning stage of sencha and have been using example code to see how it all goes together

i just can't figure out where in app.js for the example it sets that only 4 entries are returned from the rss feed.

saJoshua
5 Feb 2014, 10:29 PM
Ok, cool. It requires a bit of digging (as usual), here's the path you should take:

Open the app.js. Find the json node describing the Blog. In that, you should find the proxy > reader > url = https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://feeds.feedburner.com/SenchaBlog

Now.. If you paste that URL into a browser address bar, you'll see a response. To make it more readable, copy the response into : http://jsbeautifier.org/ and beautify it.

It's clearly only returning 4 entries..

Now Google: ajax.googleapis.com/ajax/services/feed/load

And find the API for the service.. Somewhere on the page, it lists : "Optional URL arguments".

The one that's probably most useful is:
num=100 Applicable to load feed only. This optional argument supplies the number of entries to load from the feed specified by q. A value of -1 indicates the maximum number of entries supported, currently 100. By default, load feed returns four results.

Adding this parameter to the URL will return more results..

VOILA!