rss feed for most read
  • Hi all

    we use mailchimp for our rss to email campaigns

    im trying to set up an email campaign for most read articles of the week

    i have it set up as a newscoop section as i have been doing the emails manually, using the code

    {{ set_current_issue }}
    {{assign var="xdate" value="-7 days"|date_format:"%Y-%m-%d"}}
    {{ list_articles length="20" ignore_section="true" order="bypopularity desc" constraints="type is news" constraints="publish_date greater $xdate reads greater 0" }}

    but this does not work in rss

    is their another way of setting a date constraint which is rss compliant

    cheers
  • 8 Comments sorted by
  • Hi,

    your code should work, maybe two sets of constraints are the problem. Put them in one constraints.

    You may also try this way (example is for 2 days old news, change the numbers for 7 days)

    {{ assign var="twodaysback" value="`$smarty.now-172800`" }}
    {{ assign var="twoback" value=$twodaysback|date_format:"%Y-%m-%d" }}

    {{ list_articles ignore_section="true" order="bypopularity desc" constraints="type is news publish_date greater_equal $twoback" }}
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • Hi

    thats not worked either

    enclosed is the rss.tpl with the new code left as 2 days

    i dont know if im missing something else


    2K
  • Does it send any error? What does this template generate, only rss header or..? Can you show the source of the outputted page?
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • just shows header

    www.lincolnshiretoday.net/en/static/rss
  • Well the template is parsed to the end which means it's correct; list is not generating any results, probably statistics for article reads are not collected.
    There are two ways to turn on article stats (number of reads, that are used to calculate popularity) - in Configure -> System preferences check 'Automatic collection of statistics' and also for your article type, for example 'news', for field 'full_text' (or whatever is your main content field) check 'is_content' switch. The other, non-automatic way of collecting stats, is to put {{ count }} command somewhere in your article template. 
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • Hi Ijuba

    collect statistics is yes and is_content is ticked

    whats is the count command ive never used that before
  • {{ count }} is the way to manually - in template - trigger stats collecting because automatic way generates some javascript code in full_text field that then makes this field to validate as non-empty even if it is empty.

    List doesn't return anythnig so it should be debugged; try other options (byComments, byLastComment) - does it return anyhnig? Do you have more publications on this instance? Try to force the context of the listed articles (ignore_issue, set_current_issue, set_publication identifier="XX") and report back the results of your testing
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • i can do most bycomments etc etc etc but once i put the date code in it fails

    just tried it on another machine to make sure it wasnt a cache probleme etc and firefox was open so using that it works!

    tried in IE and safari and it doesnt

    checked mailchimp and that is working and thats the main thing

    thanks for your help