Hello,
I’m sort of struggling with a customized RSS feed template I’m trying to create. It’s purpose is to feed into an automated weekly newsletter we send out to members. The goal is to create a feed that displays the top 12 news entries in terms of most views since the last weekly newsletter. I don’t think I’m able to have it gigure out what it sent last, so at the very least, wanted to setup an interval such as top 12 news entries since the previous 12:01am Sunday.
Anyhow, here’s the code I have (which seems to pull in the top 12 posts of all time.
Hoping one of you more savvy devs out there can point me in the right direction.
Thanks in advance.
{exp:rss:feed channel="news"}
<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>{exp:xml_encode}SITE NAME HERE{/exp:xml_encode}</title>
<link>http://www.LINK.com/</link>
<description>Newsletter RSS Feed</description>
<dc:language>{channel_language}</dc:language>
<dc:creator>CREATOR HERE</dc:creator>
<dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
<dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
<admin:generatorAgent rdf:resource="http://expressionengine.com/" >
<?php $start_time = $this->EE->localize->decode_date('%Y-%m-%d %H:%i', $this->EE->localize->now - 561600); ?>
{exp:channel:entries channel="news" rdf="off" start_on="<?php echo $start_time; ?>" limit="12" orderby="view_count_one" dynamic_start="on"}
{exp:nsm_transplant:body}
{exp:low_replace find=" "replace="SPACE"}
<item>
<title>{title}</title>
<link>http://www.PATH.com/news/{url_title}</link>
<guid>{homepage}/news/{url_title}</guid>
<image>
{news_thumb}
</image>
<thumb>{news_thumb}</thumb>
<description>
<![CDATA[
{exp:allow_eecode embed="y"}
{exp:trunchtml chars="365" inline="..."}
{news_excerpt}
{/exp:trunchtml}
{/exp:allow_eecode}
]]>
</description>
<dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
</item>
{/exp:low_replace}
{/exp:nsm_transplant:body}
{/exp:channel:entries}
</channel>
</rss>
{/exp:rss:feed}