Search

I’m gradually making my way through my first real Symphony build (the new tutorials and guides are great - cheers!) and have come up against something I can’t quite get my head around.

I’d like to create an RSS feed using a DS which draws data from two Sections and sorts the whole lot by date. Seeing how DSs are only allowed to have a single Section in their Source setting, how do I best go about this?

I found mention of ‘DS chaining’ in some older discussions but couldn’t quite fathom exactly how this works. Is this what I should be doing? If anyone could elaborate on this I just might do some cartwheels.

Hang on - am I thinking about this all wrong?

I can just add the DS for each section to the RSS feed page. But then how can I sort all the entries by date together?

Please excuse this noob’s confusion.

I can just add the DS for each section to the RSS feed page.

Yep.

But then how can I sort all the entries by date together?

There is a sort command in xslt (xsl:sort). I think you can apply a sort to multiple elements, and probably sort by the ‘date’ field. Haven’t had to do it myself.

The ‘DS chaining’ is used in a different context, when you need some par of the result of 1 DS to be used as a filter for another DS, for instance filtering a ‘comments’ DS by a post id that is output by your ‘posts’ DS.

There is a sort command in xslt (xsl:sort). I think you can apply a sort to multiple elements, and probably sort by the ‘date’ field.

Yes, this works. This is what I do to build an RSS feed on one of my sites. Since I need to sort by date and time, I simply concat both strings including punctuation marks and use “text” as data type. (You could as well build a number, of course.)

<xsl:for-each select="rss-news/entry | rss-activities/entry">
    <xsl:sort select="concat(date, date/@time)" data-type="text" order="descending"/>
    <item>
        <title>
            ...

Brilliant. Thank you both. It all seems to obvious once you know how :)

And nice tip on using the concat on the date & time for the sorting Michael.

Now for cartwheels.

And nice tip on using the concat on the date & time for the sorting Michael.

It’s not sincere Ninja Coding, but it works. :-)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details