We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24074
    • 81 Posts
    Hi, is there a better way of creating RSS feeds then this http://modx360.com/blog/2010/02/getresources-rss-feed.html ?
    And if yes, please share.

    Thanks
      Radio sucks!
    • This works too: http://modxcms.com/forums/index.php/topic,59632.msg339285.html#msg339285


      This link (just tweeted!) looks similar but explains it in more detail: http://journal.simonf.co.uk/share-share-alike


      Just wondering though. What’s wrong with the method in that link?
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 21838
        • 284 Posts
        That is the common and best practice way on how to create a rss feed. Why do you actually ask that? Do you have something particular to ask for a how-to?
          MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
        • purpler,

          You can simplify the method Garry shows on his site a bit.

          First: Create a Template with this:
          <?xml version="1.0" encoding="UTF-8"?>
          <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
          <channel>
              <title>[[*pagetitle]]</title>
              <link>[[~[[*id]]? &scheme=`full`]]</link>
              <description>[[*description:cdata]]</description>
              <language>[[++cultureKey]]</language>
              <ttl>120</ttl>
              <atom:link href="[[~[[*id]]? &scheme=`full`]]" rel="self" type="application/rss+xml" />
                  [[*content]]
          </channel>
          </rss>


          Second: Create a chunk for your rssItem &tpl:
          <item>
              <title>[[+pagetitle:cdata]]</title>
              <link>[[++site_url]][[~[[+id]]]]</link>
              <guid>[[++site_url]][[~[[+id]]]]</guid>
              <pubDate>[[+createdon:strtotime:date=`%a, %d %b %Y %H:%M:%S %z`]]</pubDate>
              <description>[[+introtext:cdata:default=`[[+content]]`]]</description>
          </item>


          Finally, create the document resource for your rss feed and insert:
          [[!getResources? 
             &parents=`3`
             &limit=`10`
             &sortby=`createdon`
             &sortdir=`DESC`
             &includeTVs=`1`
             &includeContent=`1`
             &tpl=`rssItem`
          ]]


          You’ll want to change the "Content Type" to RSS or XML (both should work) for the document resource containing the RSS feed. Also, you don’t need to create the output filters in Garry’s tutorial because those are now built in to Revo.

          I recommend using a template that way you just need to update the feed resources. It should only take a few minutes to get a feed working. Once you do you can check it using: http://validator.w3.org/feed/

          Other notes: I don’t use createdon as the date as it doesn’t make sense unless you publish documents immediately and want them posted. I prefer to use an ArticleDate TV and that way I can control when a document is for publication, especially in the case of migrating legacy blog posts which is a heck of a lot easier than editing the tables.

          Best of luck.

          Cheers,

          Jay
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
            • 24074
            • 81 Posts
            I don’t know if I’m doing something wrong but this just doesn’t work for me..
            Feed <item>’s aren’t pulled in for some reason.

            Check: http://werform.com/feed
              Radio sucks!
            • Did you change the &parents=`3` in the getResources snippet to the ID of your container resource?
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • Same problem - I can’t get the feed to pull the <item>

                http://www.turnaroundweek.com/index.php?id=23
                  • 24074
                  • 81 Posts
                  I tried everything crossed my mind..
                    Radio sucks!
                  • When I tried to validate the feed I got the following response - note line 15. I’m mystified!:

                    Sorry
                    This feed does not validate.
                    line 10, column 0: Unexpected Text (8 occurrences) [help]

                    [2011-01-12 16:05:56] (ERROR @ /index.php) Error 42000 executing sta ...

                    line 15, column 147: Undefined channel element: br [help]

                    ... sion for the right syntax to use near ’`
                    ,10,26,30,32,33,34,35,45 ... ^

                    Source: http://www.turnaroundweek.com/index.php?id=23

                    01.<?xml version="1.0" encoding="UTF-8"?>
                    02.<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
                    03.<channel>
                    04. <title>RSS</title>
                    05. <link>http://www.turnaroundweek.com/index.php?id=23</link>
                    06. <description><![CDATA[ ]]></description>
                    07. <language>en</language>
                    08. <ttl>120</ttl>
                    09. <atom:link href="http://www.turnaroundweek.com/index.php?id=23" rel="self" type="application/rss+xml" />
                    10. [2011-01-12 16:05:56] (ERROR @ /index.php) Error 42000 executing statement:
                    11.Array
                    12.(
                    13. [0] => 42000
                    14. [1] => 1064
                    15. [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’`
                    ,10,26,30,32,33,34,35,45,51,46,47,48,49,50) AND (`modResource`.`conte’ at line 1
                    16.)
                    17.
                    18.
                    19.</channel>
                    20.</rss>
                    21.
                    • Sounds like you have an issue with your getResources call.

                      Is the parent hidden from menus?

                      Are the docs published or hidden from menus? This first one may seem obvious but it is a pretty good gotcha. The second, I don’t recall if this matters. Make sure that if your docs are hidden that you add the &showHidden=`1` to your getResources call.

                      Is there by chance an error in your template? i.e. your [[*content]] calls.

                      See if anything works there.

                        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub