Search

I have a section on a newspaper website that is supposed to display recently written articles randomly. What I am thinking of doing is to query a lot of articles, and then have it order randomly, then limit to 4. Because the articles that are transferred from print to web have a specific issue number attached, all I have to do for those is to filter out the most recent issue. However, there are also web only articles that don’t have issue numbers. Is there anyway to filter the date so that it gets articles posted in the last 7 days?

Bump and suggestion.

Can system-date be exposed through the Filter in the DS Editor?

You can filter entries by their date and you can use $params on the page like $today, but I’m not sure how to count back 7 days.

You could use the global parameter loader to create a parameter from the current unix timestamp minus the seconds in one week. Create a new parameter with name “lastweek” and value return(date("Y-m-d", time() - 7 * 24 * 60 * 60));

Then, filter your data source by date with value {$lastweek:$today}.

I haven’t tested if the filter works, so could you see if it does?

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