6 users online. Create an account or sign in to join them.Users

Search

Hi all, it’s Monday and my brain has not kicked on yet!

I’m trying to get a data source to output the newest 7 entries in a section and then sort them in ascending date order. I was able to get an approximation by using “later than last week” as a filter, but this is too time-specific (it depends on there being 7 entries within the past week, and this may not be the case.)

I considered using descending sort on the data source and then re-sorting in XSLT. Any other clever approaches? Maybe pagination?

Yes, the most efficient would be to get the latest seven is descending order (ordering by System Date, limit to 7 entries) from the database and then re-sort in your presentation layer. The re-sort should be as easy as:

<xsl:for-each select="entry">
    <xsl:sort select="position()" data-type="number" order="descending"/>
    ...
</xsl:for-each>

Fantastic, thanks Nick (as always)!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details