RSS Ordering


The RSS datarepeater does not respect the order or items in my XML file and there does not seem to be any way to change/edit this. Items are ordered by date in descending order but I want them in ascending order (oldest first) for one particular datarepeater block.


roshodgekiss roshodgekiss, 5 years ago

Hi there redpaint, as you've noticed, it isn't possible to change the order of RSS items in a datarepeater. This is something we hope to look into at a later date, so by all means, I'll keep you posted if we make it possible to reverse the order of posts. Sorry for this trouble here!

Get in touch with us on Twitter:
We're also on Facebook:
redpaint, 5 years ago

This is a real blow, at the very very least I would have expected Ascending/Descending order or even just simply following the order as set in the RSS feed.

I can't really see how your existing system is fit for purpose without this feature.

redpaint, 5 years ago

While you're making changes it would be useful to have a clear RSS posts because trying to manually add and remove them (using Firefox) is very buggy, they don't always get removed when you have unselected them from the right hand side and then clicked "Done" then gone to the preview they often re-appear.  Attempting to clear a datarepeater is frustrating and time consuming.

roshodgekiss roshodgekiss, 5 years ago

Sorry about this, redpaint - we'll see what we can do about reordering posts, hopefully in a future update.

I'm concerned about this buggyness in Firefox and would really like a few more details on what's happening here for you. I've just sent you an email, so hopefully we can get to the bottom of this before long. Sorry for this trouble!

Get in touch with us on Twitter:
We're also on Facebook:
lmeurs lmeurs, 4 years ago

When importing an RSS feed, the order of items is always turned into descending (= highest dates first). This might be okay with ie. news items (newest articles first), but with a feed of upcoming events one wants the nearest event (oldest date) on top of the list.

I changed the order of my RSS feed, but this did not matter. I do not understand why CM does not respect the order of the feed?!?

So I contacted the support desk, this is their answer:
"This is definitely something that has been raised by a number of questions and we have an enhancement request logged for it. I've added a vote based on your request. Unfortunately, this is not going to change in the immediate future."

The RSS feed implementation has a lot of potential, a great way to easily connect with external systems, a huge selling point to our customer, but unfortunately useless due to this shortage...

We had to write a Drupal module that:
- Reads an RSS feed,
- Itterates through the feed's items,
- Gets the item's publication date,
- Add a human readable publication date to the item's title,
- Alter the publication date to current date, each item decrementing 1 second.

Now the feed's items have descending publication dates, the order is still in tact. But since we changed the publication dates, we cannot use this date in our mail template using <rssitemday /> tags, that is why we added the date to the title.

Here is our PHP code. Put the script somewhere on your server and call it with ie.


// See
$doc = new DOMDocument();

// Check for query string.
if (empty($_GET['url'])) {
  throw new Exception('Please supply the URL of an RSS feed as a GET variable.');
// Try to load RSS feed.
elseif (!$doc->load($_GET['url'])) {
  throw new Exception('Cannot load RSS feed from ' . $_GET['url']);

// NB: $doc->load() resets locale to English, why?
setlocale(LC_ALL, isset($_SERVER['WINDIR']) ? 'nld_nld' : 'nl_NL');

// Itterate through feed's items.
foreach ($doc->getElementsByTagName('item') as $i => $node) {
  // Get title and pubDate nodes.
  $title = $node->getElementsByTagName('title')->item(0);
  $pubDate = $node->getElementsByTagName('pubDate')->item(0);

  // Turn pubDate into timestamp.
  $timestamp = strtotime($pubDate->nodeValue);
  // Get platform depending date formatter.
  $date_formatter = isset($_SERVER['WINDIR']) ? '%#d %B %Y' : '%e %B %Y';
  // %e adds extra space to single numbers, remove all extra spaces.
  $date = trim(preg_replace('#  +#', ' ', strftime($date_formatter, $timestamp)));

  // Set new values.
  $title->nodeValue = $date . ': ' . $title->nodeValue;
  $pubDate->nodeValue = date('r', time() - $i);

print $doc->saveXML();
roshodgekiss roshodgekiss, 4 years ago

Hi lmeurs, thank you for being so proactive here and sharing your code! I'm sure it's going to come in very useful. As mentioned, we'll continue to look into making it possible to reorder our RSS feeds and will let you know if it's something we introduce in a future update.

Get in touch with us on Twitter:
We're also on Facebook:
CapicheDesign CapicheDesign, 4 years ago

Hi, I am wondering if this feature is still a possibility?

We have clients looking at the most efficient way to share stories. The best way I can see is by having full articles on their website and then driving traffic to the site via article excepts in email newsletters. Your RSS feature is perfect for this! Unfortunately it is lacking in feed control at the moment and frustratingly has meant us dropping it's use.

If you could add custom ordering and layout template selection per feed item then I think you would have a killer product! The ease of use in creating newsletter would likely mean an increase in newsletter frequency, which I'm sure would make your investment in time well worthwhile in the long run.

roshodgekiss roshodgekiss, 4 years ago

Hi CapicheDesign, thank you so much for your feedback here! You're right - there's a lot more than can be done in regards to featuring RSS feeds in email, so by all means, I'l make sure your suggestion on custom ordering gets heard. If we make any changes in this regard, we'll most certainly be in touch.

In regards to "layout template selection per feed item" - would this be the ability to apply different CSS styles, for different imported feed items? Let us know, as we may be able to suggest workarounds in the interim.

Thanks, Capiche! Sorry for the roadblock here, but we hope we can make things a better fit for you.

Get in touch with us on Twitter:
We're also on Facebook:
iamirm, 4 years ago

@lmeurs Thanks so much for posting your solution & script, this really helped me out!

richp.75, 3 years ago

I see this feature was originally asked for two years ago and so far it looks like nothing much has happened?

The whole RSS repeater feature is really killed by the way you override your user's preferences for ordering as defined in the feed with your own preferences which are not suitable in many obvious cases.

Is this ever ever going to change? It's a real blocker for us.

richp.75, 3 years ago

Just to share with anyone else who stumbles on this, I believe we found another workaround that didnt involve code...

We changed the date format in our RSS feed to something invalid like "time since publication" (eg "four days ago") and then removed any reference to the date display fields in our CM templates.

With both these things done, it picked up the ordering in the RSS feed... I presume because it didnt have any dates it could interpret to fall back on.

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free