This dirty, badly-written code will allow you to format your Flickr RSS feed by breaking it out into ASP.
The first portion of the code grabs your feed and initializes it. The second portion breaks apart the feed into separate variables:
By breaking these apart, you can format them individualy. The majority of this information is combined under the description field in the unaltered feed, so your formatting options are limited.
The Code
Only one variable you really need to replace: RSSURL (the link to your feed). The PhotosPerPage variable is not optional in this example, but you can easily modify it.
<html>
<head>
<style type="text/css">
<!--
body
{
font-family: verdana, arial, helvetica, sans-serif;
}
.RSSImage
{
border: 1px solid black;
}
a.RSSTitle:link, a.RSSTitle:visited
{
font-size: 12px;
font-weight: bold;
color: black;
text-decoration: none;
}
a.RSSTitle:hover
{
font-size: 12px;
font-weight: bold;
color: black;
text-decoration: underline;
}
.RSSByline
{
font-size: 10px;
}
a.RSSByline:link, a.RSSByline:visited
{
font-weight: bold;
color: black;
text-decoration: none;
}
a.RSSByline:hover
{
font-weight: bold;
color: black;
text-decoration: underline;
}
.RSSDescription
{
font-size: 10px;
line-height: 14px;
}
-->
</style>
</head>
<body>
<table cellpadding="0" cellspacing="10" border="0" width="750">
<%
RSSURL = "http://www.flickr.com/services/feeds/photos_public.gne?id=24328811@N00&format=rss_200"
PhotosPerPage = 5
Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0")
xmlHttp.Open "Get", RSSURL, false
xmlHttp.Send()
RSSXML = xmlHttp.ResponseText
Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
xmlDOM.async = false
xmlDOM.LoadXml(RSSXML)
Set xmlHttp = Nothing
Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS
Set xmlDOM = Nothing
RSSCount = RSSItems.Length-1
FOR i = 0 To RSSCount
Set RSSItem = RSSItems.Item(i)
FOR each child in RSSItem.childNodes
SELECT case lcase(child.nodeName)
case "title"
RSSTitle = child.text
case "link"
RSSLink = child.text
case "description"
RSSDescription = child.text
case "pubdate"
RSSPostDate = child.text
END SELECT
NEXT
IF j = "" THEN
j = 0
ELSE
j = j+1
END IF
RSSDescriptionLength = Len(RSSDescription)
RSSPostDateLength = Len(RSSPostDate)
RSSAuthorLinkQFirst = InStr(RSSDescription, """")
RSSAuthorLinkQSecond = InStr(RSSAuthorLinkQFirst + 1, RSSDescription, """")
RSSAuthorLink = Mid(RSSDescription, RSSAuthorLinkQFirst + 1, RSSAuthorLinkQSecond - (RSSAuthorLinkQFirst + 1))
RSSAuthorGT = RSSAuthorLinkQSecond + 2
RSSAuthorLT = InStr(RSSAuthorGT, RSSDescription, "<")
RSSAuthor = Mid(RSSDescription, RSSAuthorGT, RSSAuthorLT - (RSSAuthorGT))
RSSImageLinkQFirst = InStr(RSSAuthorLT, RSSDescription, """")
RSSImageLinkQSecond = InStr(RSSImageLinkQFirst + 1, RSSDescription, """")
RSSImageLink = Mid(RSSDescription, RSSImageLinkQFirst + 1, RSSImageLinkQSecond - (RSSImageLinkQFirst + 1))
RSSTitleQFirst = InStr(RSSImageLinkQSecond + 1, RSSDescription, """")
RSSTitleQSecond = InStr(RSSTitleQFirst + 1, RSSDescription, """")
RSSTitle = Mid(RSSDescription, RSSTitleQFirst + 1, RSSTitleQSecond - (RSSTitleQFirst + 1))
RSSImageQFirst = InStr(RSSTitleQSecond + 1, RSSDescription, """")
RSSImageQSecond = InStr(RSSImageQFirst + 1, RSSDescription, """")
RSSImage = Mid(RSSDescription, RSSImageQFirst + 1, RSSImageQSecond - (RSSImageQFirst + 1))
RSSImageWidthQFirst = InStr(RSSImageQSecond + 1, RSSDescription, """")
RSSImageWidthQSecond = InStr(RSSImageWidthQFirst + 1, RSSDescription, """")
RSSImageWidth = Mid(RSSDescription, RSSImageWidthQFirst + 1, RSSImageWidthQSecond - (RSSImageWidthQFirst + 1))
RSSImageHeightQFirst = InStr(RSSImageWidthQSecond + 1, RSSDescription, """")
RSSImageHeightQSecond = InStr(RSSImageHeightQFirst + 1, RSSDescription, """")
RSSImageHeight = Mid(RSSDescription, RSSImageHeightQFirst + 1, RSSImageHeightQSecond - (RSSImageHeightQFirst + 1))
RSSDescriptionBylinePFirst = InStr(RSSDescription, "<p>")
RSSDescriptionBylinePSecond = InStr(RSSDescriptionBylinePFirst + 3, RSSDescription, "<p>")
RSSDescriptionBylinePThird = InStr(RSSDescriptionBylinePSecond + 3, RSSDescription, "<p>")
RSSDescriptionTrueLength = RSSDescriptionLength - (RSSDescriptionBylinePThird)
IF NOT RSSDescriptionBylinePThird = 0 THEN
RSSDescription = Mid(RSSDescription, RSSDescriptionBylinePThird, RSSDescriptionTrueLength + 1)
ELSE
RSSDescription = ""
END IF
RSSPostDate = Mid(RSSPostDate, 6, RSSPostDateLength - 11)
RSSPostDate = CDate(RSSPostDate)
IF J<PhotosPerPage then
%>
<tr>
<td valign="top" align="right"><a href="<%=RSSImageLink%>" target="_blank"><img src="<%=RSSImage%>" border="0" alt="<%=RSSTitle%>" class="RSSImage"/></a><br />
</td>
<td valign="top">
<div class="RSSTitle"><a href="<%=RSSTitle%>" class="RSSTitle"><%=RSSTitle%></a></div>
<div class="RSSByline">Posted <%=RSSPostDate%> by <a href="<%=RSSAuthorLink%>" class="RSSByline" target="_blank"><%=RSSAuthor%></a></div>
<div class="RSSDescription"><%=RSSDescription%></div>
</td>
</tr>
<%
ItemContent = ""
RSSAuthorLinkQFirst = ""
RSSAuthorLinkQSecond = ""
RSSAuthorLink = ""
RSSAuthorGT = ""
RSSAuthorLT = ""
RSSImageLinkQFirst = ""
RSSImageLinkQSecond = ""
RSSImageLink = ""
RSSDescriptionBylineFirst = ""
RSSDescriptionBylineSecond = ""
END IF
NEXT
%>
</table>
</body>
</html> |
Like I said, this is some dirty and certainly inefficient code. I'm a designer first, developer second so consider this a means to an end. If you have suggestions for improving it, I'm all ears - kpalyu -at- gmail.com.
The Example
Here's what the code above produces...
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |