Search

Well, the topic title says it all really: I want to create a DS where I randomly get three entries from a section, but I don’t want any of the three latest. Is it possible without going into the DS’ php-code?

If you want to keep this in a single DS then yes.

You could create one DS that pulls the latest third entry, using a Date field as the Output Parameter: order by Date, show one entry per page, and show page 3.

You can then create the DS that chooses random entries where the Date is “earlier than {$ds-latest-three}”.

Nice solution! Thanks.

I was going to suggest having 2 DS, one with 3 latest entries and another pulling 6 random entries. Then use XSLT to pick out of the 6 random entries, filtering out the possible 3 that may be the latest ones.

However, Nick’s suggestion is more elegant in that the logic is done on the data side rather than the template side.

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