I'm designing an application that would benefit from have rss news/blog feeds displayed
Is there a way to do this?
Jim
Is there a way to do this?
Jim
--################################## --## Custom Function Informations ## --################################## -- Disclaimer: This code might have bugs, but I did all I could to remove most of them. --You are allowed to use this on a commercial app, however DO NOT USE THIS ONLY AS AN APP. T -- A linkback/credit is not needed, but would be appreciated. -- Done by: FoxLeader --URL: http://www.foxleader.net ------------------------------------------------------- -- Language Vars: --Publish date published = "Publié: " --Open new's link openLink = "Ouvrir la nouvelle" --"Downloading" text for status message msgDownloading = "Connexion..." --"Loading" text for status message msgLoading = "Traitement en cours..." --Properties of the status text RSS_StatusProp = {} RSS_StatusProp.Enabled = false RSS_StatusPropColor = "FFFFFF" --In Hexadecimal RSS_StatusProp.ColorNormal = Math.HexColorToNumber(RSS_StatusPropColor); --Don't change this RSS_StatusProp.X = 920 RSS_StatusProp.Y = 10 RSS_StatusProp.FontSize = 8 --## Vars: --"url" is the url of the (online) RSS feed --"dir" is the target directory to download to ------------------------------------------------------- --[[ Usage: Put this (exemple) OnShow or on any button: RSS.Get("http://www.indigorose.com/forums/external.php?type=rss", _SourceFolder.."AutoPlay\\Docs\\feed.xml") to download the feed. Then, put this (exemple again) where you want it: RSS.Load("Feed", true) You absolutely need the following objects: Feed_Name (Label) Feed1_Content (Paragraph) Feed1_Title (Label) Feed1_Title (Label) That's it! Any enhancements are welcome. Share them on the forums! ]] RSS = {} function RSS.ShowStatus(show, type) if show == true then Page.CreateObject(OBJECT_LABEL, "RSS_Status", RSS_StatusProp); --Types: --1 is download --2 is loading if type == 1 then Label.SetText("RSS_Status", msgDownloading) elseif type == 2 then Label.SetText("RSS_Status", msgLoading) end elseif show == false then Page.DeleteObject("RSS_Status"); end end function RSS.Get(url, dir, showStatus) --Show the message RSS.ShowStatus(true, 1) --Download the feed HTTP.Download(url, dir, MODE_BINARY, 20, 80, nil, nil, nil); XML.Load(dir); --Hide the message RSS.ShowStatus(false) end function RSS.Load(prefix, titleClick, showStatus) --Show the message RSS.ShowStatus(true, 2) --[ Will be removed when enhanced as a loop (Start)] no = 1 --[ Will be removed when enhanced as a loop (End) ] --Get the feed name name = XML.GetValue("rss/channel/title"); --Show the feed name Label.SetText(prefix.."_Name", name); --Get the first item's values title = XML.GetValue("rss/channel/item/title"); link = XML.GetValue("rss/channel/item/link"); description = XML.GetValue("rss/channel/item/description"); pubDate = XML.GetValue("rss/channel/item/pubDate"); --Show the feed's title Label.SetText(prefix..no.."_Title", title); --Add an OnClick, cursor and tooltip on the title if enabled if titleClick == true then --OnClick linkScript = "File.Open(link, '', SW_SHOWNORMAL);" Page.SetObjectScript(prefix..no.."_Title", "On Click", linkScript); --Tooltip & Cursor titleClick_Propert = {} titleClick_Propert.TooltipText = openLink titleClick_Propert.Cursor = CURSOR_HAND Label.SetProperties(prefix..no.."_Title", titleClick_Propert); end --Show the date Label.SetText(prefix..no.."_Date", published..pubDate); --Show the feed's content (description) Paragraph.SetText(prefix..no.."_Content", description) RSS.ShowStatus(false) end
Comment