...

View Full Version : Sorting of RSS data



Nicklarzn
12-07-2010, 06:59 AM
Hello everyone
I'm quite new at this coding-thing and hope that you can help me out.

On my website www.visitmariagerfjord.dk i have put a RSS feed, wich shows the upcoming events in my munincipality. But they are not sorted properly...

The articles shown in the RSS are events. The event-date is written in the title and in order for me to sort them by the event-date i sort them by the title in the code.

BUT this makes it sort the articles by only the first letter in the title
sthat it i.e. looks like this:

11. december: event 1
2. december: event 2
4-5. december: event 3

what have i done wrong? here is the code i used:


<head>
<meta http-equiv="Content-Language" content="da">
<style type="text/css">
.style1 {font-family: Verdana; font-size: xx-small; }
a { color: #CC0034; }
a:active { color: #CC0034; }
a:hover { color: #CC0034; } .
style2 { line-height: 150%; }
</style>
</head>
<table style="width: 211px" cellspacing="0" cellpadding="0">
<tr>
<td class="style1">
<p class="style2"><head></head>
<SCRIPT type=text/javascript src="http://www.google.com/jsapi/?key=ABQIAAAA9eRU-vAdivYIHMi8NypOyhR6VdgIuGtsbVFT62Qxi5tkD2_rtRTAXgOh9iGox0fIywO62d3SLZxAhA"></SCRIPT>
<SCRIPT type=text/javascript src="gfeedfetcher.js"></SCRIPT>
<body style="background-color: #EAEDE4">
<SCRIPT type=text/javascript>
var socialfeed=new gfeedfetcher("example2", "example2class", "_new")
socialfeed.addFeed("Kommende arrangementer", "http://www.visitmariagerfjord.dk/danmark/da-dk/menu/turist/det_sker/arrangementer2010/rss.htm?WBCMODE=PresentationUnpublished&rss=true")
socialfeed.setentrycontainer("div")
socialfeed.filterfeed(4, "title")
socialfeed.init()
</SCRIPT>
</p>
</td>
</tr>
</table>

Spudhead
12-07-2010, 11:47 AM
The date is being stored as a string. Sorting a string will do so alphabetically. To sort by date you need your dates to be in a valid date format, which won't be easy as some of the dates seem to date ranges.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum