A simple Run BASIC widget for viewing images in a Flickr RSS 2.0 feed.

' Fetch Flickr feed
' ---
' Global type variables
defaultfeed$ = "http://flickr.com/rss/feed"
current = 1
rsslen = 0
rsscnt = 1
 
' Initial start screen
[start]
cls
html "<div style=""width:100%;text-align:center;"">"
input "Enter your Flickr RSS 2.0 feed: "; url$
html "</div>"
 
' Fetches the provided RSS stream
[fetch]
if len(url$) = 0 then url$ = defaultfeed$ else url$ = url$
 
result$ = httpget$(url$)
 
if len(result$) > 0 then goto [parse] else goto [fail]
 
[parse]
xmlparser #rss, result$
 
#channel = #rss #element(1)
rsslen = #channel elementCount()
 
dim pics$(rsslen)
dim urls$(rsslen)
 
' Loads everything into the two arrays
for x = 1 to rsslen
 
  #item = #channel #element(x)
 
  if (#item key$() = "item") then
 
    #link = #item #element(2)
    urls$(rsscnt) = #link value$()
 
    #mc = #item #element(8)
    pics$(rsscnt) = #mc attribValue$("url")
 
    rsscnt = rsscnt + 1
 
  end if
next x
 
' Displays one picture at a time
[display]
cls
html "<div style=""width:100%;text-align:center;"">"
print current
Call ShowPic urls$(current) pics$(current)
link #b, "Previous", [back]
print " ";
link #f, "Forward", [forward]
print ""
html "<p>"
link #a, "Show All", [show all]
html "</p>"
html "</div>"
wait
 
' Shows all the pictures in the feed
[show all]
cls
html "<div style=""width:100%;text-align:center;"">"
for piccy = 1 to rsscnt - 1
  Call ShowPic urls$(piccy) pics$(piccy)
next piccy
html "<p>"
link #d, "Just Show One", [display]
html "</p>"
html "</div>"
wait
 
' Forward by one picture
[forward]
if current = rsscnt then current = 1 else current = current + 1
goto [display]
 
' Back by one picture
[back]
if current = 1 then current = rsscnt -1 else current = current - 1
goto [display]
 
' In the event the URL call fails
[fail]
cls
html "<div style=""width:100%;text-align:center;"">"
link #fail, "Try again", [fetch]
html "</div>"
wait
 
' Generates the HTML for each picture
Sub ShowPic Furl$ Fpic$
  html "<p>"
  html "<a href=""" + Furl$ + """ target=""_blank"">"
  html "<img src=""" + Fpic$ + """ border=""0"" /></a>"
  html "</p>"
End Sub