We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2912
    • 315 Posts
    Hi All,

    I’ve been trying to set up a way to have a dynamic RSS Feed. I want to create a ditto call which I can add to a chunk that appears on numerous pages.

    I’ve tried ultimateparent calls and such but I cannot get it to work with out creating an RSS feed page for each section I wish to feed. I looked into FeedX but I couldn’t get that to play ball sad

    Can anyone help me?

    Thanks.
      BBloke
      • 27376
      • 576 Posts
      You will need to create a MODx document for each RSS feed. Granted, all the documents will call the same chunk in your scenario, but if you use [[UltimateParent]] in your ditto call, the output of each them will be different if they are in different containers.
        • 2912
        • 315 Posts
        Thanks for that sirlancealot. At least that way a feed page can be duplicated with less fuss. smiley
          BBloke
          • 18397
          • 3,250 Posts
          You could create a single document with &extenders=`request` added to the Ditto call. Then just add a link to [~####~]?ditto_parents=[[UltimateParent]] on each page.
            • 2912
            • 315 Posts
            Thanks for your reply Mark. I’ll do some more reading as I’m not sure what it is exactly but thanks for pointing me in that direction. I’m still fairly new to modx and extenders are a new thing at the mo.

            Update:

            Thanks for the extenders bit. I have a single document with [!Ditto? $extenders=`request`!] called.
            The webpage I wish to feed from is the parent itself so my link from that is: [~####~]&ditto_parents=[~id~] which all seems to parse through great.

            There is one strange thing... the normal way I was doing it showed a great RSS Feed page in Firefox. The new way, which is just blowing me away, shows the following error on the XML page:

            XML Parsing Error: xml declaration not at start of external entity
            Location: http://myserver.com/montydan/RSSFeeds?ditto_parents=60
            Line Number 2, Column 1:<?xml version="1.0" encoding="UTF-8" ?>
            ^
            


            Yet I checked both XML sets of code and there appears to be nothing wrong in with it.

            Thanks again Mark smiley
              BBloke
              • 18397
              • 3,250 Posts
              That means you have whitespace before the start of the Ditto call. Remove it, and all should be well.
                • 2912
                • 315 Posts
                I’ve removed all whitespace from both the RSS Feed page ditto call and the URL code (which is in a chunk) and I get the same result. Normally the XML starts on line 1 but when using the extenders method XML lines start on line 2.

                I’m using FURL’s so I tried it with and without and its the same.

                Is it still me or could it be a bug!?

                UPDATE: I’ve done some searching and some major changes to things and no matter what whenever I use the extenders way around things I get an annoying new line before the XML declaration that, although it still works in Outlook 2007 other RSS news readers just refuse to play ball.

                I’ve tried to look through the code to see where an extra line could be getting in and I’m at a total loss. I have removed all whitespace from everywhere I can thing. The page template is blank and the type is set to XML.

                I would like to see it work as it should cos it certainly helps with how I’ve coded some chunks and would hate to loose the possibility if RSS feeds.

                  BBloke
                  • 18397
                  • 3,250 Posts
                  Make sure that you are not editing the call using TinyMCE or another RTE as they tend to add whitespace where it shouldn’t be.
                    • 2912
                    • 315 Posts
                    Thanks again for your reply Mark.

                    I have the document set to not be Rich Text and double checked there are no trailing carriage returns at the end of the line. There are no white spaces in the recipient Ditto call:

                    [!Ditto?extenders=`request`&format=`rss`&depth=`3`!]
                    


                    My calling URL’s can be either a single page ’parent=’ or multiple:

                    http://myserver.com/montydan/RSSFeeds?ditto_parents=47,52
                    http://myserver.com/montydan/RSSFeeds?ditto_parents=47
                    


                    The feed validator comes back with:
                    Sorry
                    
                    This feed does not validate.
                    
                        *
                    
                          line 2, column 0: XML parsing error: <unknown>:2:0: xml declaration not at start of external entity [help]
                    
                              <?xml version="1.0" encoding="UTF-8" ?>
                    
                    Source: http://myserver.com/montydan/RSSFeeds?ditto_parents=47
                    
                       1.  
                       2. <?xml version="1.0" encoding="UTF-8" ?>
                       3.  
                       4. <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
                       5. <channel>
                       6. <title>RSS Feeds</title>
                    


                    The normal way just works as is:
                    [!Ditto? &parents=`60` &format=`rss`!]
                    


                    I’ve dived into the database and checked the content and there is nothing in that shouldn’t be.

                    I have some of the code in a chunk for replication purposes could this be the reason?

                    URL code:
                    [~79~]?ditto_parents=[*id*]
                    
                    [~79~]?ditto_parents=[[UltimateParent?topLevel=`2`]]
                    


                    Thanks again,

                      BBloke
                      • 18397
                      • 3,250 Posts
                      Is there any whitespace in your chunk?