- This topic has 55 replies, 21 voices, and was last updated 10 years, 10 months ago by latika malhotra.
-
AuthorPosts
-
StephenBrownMemberAny thoughts as to how I could create the array manually, in the same format as when there is more then one item returned. I’ve tried this but it isn’t working.
This is how it is when more than 1 item is returned.
$.getJSON( url, function( data ){
events = data.query.results.rss;When only one item is returned I have tried this but it doesn’t work.
$.getJSON( url, function( data ){
if (data.query.count == 1)
{
events = [
{
channel: [
{
item: [
{pubDate: data.query.results.rss.channel.item.pubDate},
{title: data.query.results.rss.channel.item.title},
{link: data.query.results.rss.channel.item.link},
{description: [
{content: data.query.results.rss.channel.item.description.content}
]
}
]
}
]
}
];
}
else
{
events = data.query.results.rss;
}
StephenBrownMemberFinally have it working. I ended up building the array manually if there is only one item in the RSS feed.
phoneui.showActivityDialog(‘Loading events…’);
$.getJSON( url, function( data ){
if (data.query.count == 1)
{
events =[
{
channel:
{
item:
{
pubDate: data.query.results.rss.channel.item.pubDate,
title: data.query.results.rss.channel.item.title,
link: data.query.results.rss.channel.item.link,
description:
{
content: data.query.results.rss.channel.item.description.content
}
}
}
}
];
}
else
{
events = data.query.results.rss;
}
StephenBrownMemberAnd then I thought I’d check for when no items are returned. Thinking I could check for count = 0 I was surprised to find out that count = 1 for when no items are found. So I had to check if a field was undefined to branch appropriately. For the non-existent link for the showFullEvent function I just test if link is not equal to “no link” and don’t open the URL.
phoneui.showActivityDialog(‘Loading events…’);
$.getJSON( url, function( data ){
if (data.query.count == 1) {
if (typeof data.query.results.rss.channel.item === ‘undefined’)
{
events =[ { channel: { item: {
pubDate: addMinutes(new Date(), -30),
title: “No Upcoming Events”,
link: “no link”,
description:
{content: “Check back again soon…”} } } } ];
}
else
{
events =[ { channel: { item: {
pubDate: data.query.results.rss.channel.item.pubDate,
title: data.query.results.rss.channel.item.title,
link: data.query.results.rss.channel.item.link,
description:
{content: data.query.results.rss.channel.item.description.content} } } } ];
}
}
else
{
events = data.query.results.rss;
}And the function…
function showFullEvent() {
var url = events[curEventIdx].channel.item.link;
if (url != “no link”) {
window.open(url,”_blank”); }
support-octavioMemberHi sjrowny,
Can you post a small version of your project, some details about it, the code you have already written and where you are stuck. Then we can review it and provide you some feedback.
StephenBrownMemberThanks for replying, but I have got it all working. The code I used is in the last few posts.
So all is good. The app is working well.
support-octavioMemberHi sjrowny,
Thanks for your follow up. Let us know if you need further assistance.
jeremy450MemberHi there
I was wondering is there a way to add a icon to the rss feed?
I mean it goes something like
——————————-
_______
| | Title
| Icon | Description
|______| Date——————————-
the icon is already in the app
regards
Jeremy
support-michaelKeymaster@ayubsamar, et al,
We are developing an experimental componentized approach for an RSS reader. I hope to have more info in 2-3 weeks. If it all works out then we can replace of this shenanigan custom list stuff with a super simple approach.
latika malhotraMemberhi,i make a app with rss and yql and i connect my rss with my database data is well coming when there is more then one record in rss but if there is only record coming in rss it is not show in app only loading is done record not shown.i cant solve this issue
can anyone help please
i will be very thankful to you
latika malhotraMemberhi,i make a app with rss and yql and i connect my rss with my database data is well coming when there is more then one record in rss but if there is only record coming in rss it is not show in app only loading is done record not shown.i cant solve this issue
can anyone help please
i will be very thankful to you -
AuthorPosts