somebody host this somewhere, I'm running this on localhost.
Technical note the @Page and <?xml> have to be on the same line b/c some RSS readers have a carriage return bug in them
<%@ Page language="c#" ContentType="text/xml" %><?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Penny Arcade Comics</title>
<link>http://www.penny-arcade.com/view.php</link>
<description>Most recent comics</description>
<language>en-us</language>
<%
DateTime today = DateTime.Now;
for (int i=0; i!=21; ++i) {
DateTime currentDateTime = today - TimeSpan.FromDays( i );
if (
(currentDateTime.DayOfWeek == DayOfWeek.Monday)
|| (currentDateTime.DayOfWeek == DayOfWeek.Wednesday)
|| (currentDateTime.DayOfWeek == DayOfWeek.Friday)
)
{
string title = "Comic " + currentDateTime.ToString("D");
string pubDate = currentDateTime.ToString("r");
string imgSrc = "http://www.penny-arcade.com/images/" + currentDateTime.ToString("yyyy/yyyyMMdd") + "h.jpg";
%>
<item>
<title><%= title %></title>
<link><%= imgSrc %></link>
<description><img src="<%= imgSrc %>"/></description>
<pubDate><%= pubDate %></pubDate>
</item>
<%
}
}
%>
</channel>
</rss>
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.