List Articles - with date limit
  • Is there a way with Newscoop's SMARTY implementation to list articles with a limit on the number of days since the publish date, say to get articles from the last 2 days, 7 days, whatever?

    if not something like:
      published in the last 4 days

    How about something to the effect of:
      publish date == today || publish date == yesterday

    Thanks,
  • 2 Comments sorted by
  • Vote Up0Vote Down SaidSaid
    Posts: 14Member
    http://sourcefabric.booktype.pro/newscoop-42-cookbook/list-of-popular-articles-most-read/

    The next snippet will list the ten most popular articles in the last seven days. It will:

    • Assign a variable for the date that is seven days in the past
    • List the ten most popular articles in descending order
    • Set constraints so that the dates of the articles returned are within the time we set in the variable
    • Return articles regardless of issue and section 
    {{assign var="xdate" value="-7 days"|date_format:"%Y-%m-%d"}}
    {{list_articles length="10" order="bypopularity desc" constraints="publish_date greater $xdate reads greater 0" ignore_issue="true" ignore_section="true"}}

    You're better off consulting the Cookbook than asking anything of this forum!
  • Thanks.
    I didn't remember that snippet from the 'most read' entry in the cookbook, thanks.

    and I have found that last point very true, sadly.