Can an RSS Feed be Embedded in AMS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jimriley
    Indigo Rose Customer
    • Feb 2003
    • 27

    Can an RSS Feed be Embedded in AMS

    I'm designing an application that would benefit from have rss news/blog feeds displayed

    Is there a way to do this?

    Jim
    ----------------------------------
    www.tutor2u.net
    UK Online Learning Resource of the Year
  • RizlaUK
    Indigo Rose Customer
    • May 2006
    • 5552

    #2
    im not really sure, but isent a rss feed basicly a xml file?
    Embrace change in your life, you never know, it could all work out for the best

    Comment

    • Canter
      Indigo Rose Customer
      • Nov 2007
      • 56

      #3
      You could do it via a web object - just load the url of the rss feed.

      Comment

      • RizlaUK
        Indigo Rose Customer
        • May 2006
        • 5552

        #4
        im sure iv seen a rss example here somewhere...iv been looking but i can not find it
        Embrace change in your life, you never know, it could all work out for the best

        Comment

        • FoxLeader
          Forum Member
          • Nov 2006
          • 432

          #5
          Yes, there is. You would simply need to download the XML file then use AMS's XML actions to display it by studying the composition of that XML. I'll see if I can find anything.

          I'm right now doing a sample. It will just get the first item but it would be fairly easy to make it a loop (except that I don't really understand them so I would need help on that part).

          Comment

          • FoxLeader
            Forum Member
            • Nov 2006
            • 432

            #6
            Have a look here:
            I'll upload mine in a few minutes.

            Regarding my code, you're allowed to use it in another app but don't just do a news reader. This would be 60% or more of only my code. Please use your own code, too.

            The *.apz is attached. It was done in AMS6, so it's compatible with 6 and 7. Code should be backwards compatible...
            All the code is in Global Functions and a little part is on "Refresh" button. I used customs function table, so it's easier
            A plug-in could even be done with this!

            Any improvements are welcome top be shared, especially to show more that the first item however I don't really know the use of loops, so... masters, please help!

            My code:
            Code:
            --##################################
            --## 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
            Attached Files
            Last edited by FoxLeader; 04-13-2008, 12:20 PM.

            Comment

            • RizlaUK
              Indigo Rose Customer
              • May 2006
              • 5552

              #7
              You would simply need to download the XML file
              i tought so
              Embrace change in your life, you never know, it could all work out for the best

              Comment

              • FoxLeader
                Forum Member
                • Nov 2006
                • 432

                #8
                Yep. But Rizla (or anyone else), could you help me on two things?

                1st: Add a parameter to select the number of items people want to display then show them (would probably need to look thru the XML, no?)

                2nd: Add a way download the XML each specified time (pretty easy) but also to alert when there's new items. I taught maybe just compare each item to see if it has changed...? But you would need the first thing I said for that.

                Comment

                • RizlaUK
                  Indigo Rose Customer
                  • May 2006
                  • 5552

                  #9
                  i havent really looked at the code, i will take some time and look now and see if i can do anything



                  EDIT, ok, if you dont mind im going to tinker with this a little, the functions are not very freeform, certan object and object names are required, it would be better to return a table of results to workwith, i'll have a little play, but i think i can turn this into a nice little RSS LUA action plugin, lol
                  Last edited by RizlaUK; 04-13-2008, 02:01 PM.
                  Embrace change in your life, you never know, it could all work out for the best

                  Comment

                  • FoxLeader
                    Forum Member
                    • Nov 2006
                    • 432

                    #10
                    Thanks mate

                    Comment

                    • RizlaUK
                      Indigo Rose Customer
                      • May 2006
                      • 5552

                      #11
                      ok, this is going to take a little longer than i thought as RSSV1 and RSSV2 have a slightly differant format, so to make a reliable set ov actions i will need to take that into account....i'll get it done, just not tonight :yes
                      Embrace change in your life, you never know, it could all work out for the best

                      Comment

                      • FoxLeader
                        Forum Member
                        • Nov 2006
                        • 432

                        #12
                        I'll also be following this
                        I hope what I did was a least helpful !?!?

                        And the weeks starts again... (Oh yeah, I'm always happy realizing the weekend is almost finished XD)

                        Comment

                        • rexzooly
                          No longer a forum member
                          • Jul 2007
                          • 1512

                          #13
                          Originally posted by FoxLeader View Post
                          I'll also be following this
                          I hope what I did was a least helpful !?!?

                          And the weeks starts again... (Oh yeah, I'm always happy realizing the weekend is almost finished XD)
                          Thats not true NOOOOOO lol
                          Ya well week days have to come so it feels better to have a weekend lol

                          is this a project Feller you want mirroring or this one left out ?

                          Comment

                          • FoxLeader
                            Forum Member
                            • Nov 2006
                            • 432

                            #14
                            Well, it's not really finished so I'd say you should wait? Or upload it now then update it, do as you feel it

                            Comment

                            • rexzooly
                              No longer a forum member
                              • Jul 2007
                              • 1512

                              #15
                              Originally posted by FoxLeader View Post
                              Well, it's not really finished so I'd say you should wait? Or upload it now then update it, do as you feel it
                              i will wait i am busy making things anyway in Pain.net lol

                              Comment

                              Working...
                              X