We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36747
    • 138 Posts
    I would like to access the comments count, as far as I can see that information is in the array of each post in the array [content][slash][comments].

    I’m tried to create my own Placeholder (reading this http://rtfm.modx.com/display/revolution20/modX.setPlaceholders) but I failed.

    Could anybody help me to understand what should I do get the comments count with getFeed?

    Thanks in advance,
    Emiliano
      patagonia, argentina
      • 26503
      • 620 Posts
      hi;

      I’m trying to use getFeed to implement a list of events from a google calendar public XML feed. I have a couple of questions & a couple of issues/gotchas:

      Issues/Gotchas:
      - there appears to be a caching issue, I got things up and running, added a couple of events but they did not appear in the chunk output. I cleared the cache VIA the manager interface but no dice. not until I went into the site VIA shell & deleted the contents of /core/cache did the new events start showing up.
      - http vs. https, https protocol does not appear to work. Taking a quick look at the code, honestly not understanding all of it, the RSS parsing is done by a modx core module? - is this what is not respecting the https protocol? [luckily google calendars will use either]

      Questions:
      - Is there a simple way to filter feeds? i.e. some are public, others are private, private feeds just don’t have a title value in the RSS. Is there anyway to say ’show only items with a ’title’ key?
      - ordering - is it possible to order the feeds by a specific key? Currently google just publishes the feed in order of create date - which can lead to some rather odd results
      - nested keys, currently it only appears to return the first level of items, the google calendar returns an <author> key with 2 subkeys <name> & <email>, how can I grab these sub keys and output to a placeholder in my tpl chunk?

      so far it works OK, but could use some love.

      -thanks
      -sean
        *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

        Sean Kimball CLP, CLS.
        Technical Director / Sr. Developer | BigBlock Studios
        ._______________________________________________.
        Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
        27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
        phone/fax: 905-426-5525
        • 4948
        • 33 Posts
        Ive got the getFeddsnippet into my page "<ul>[[!getFeed? &url=`http://pipes.yahoo.com/pipes/pipe.run?_id=111fe3d461921b3ewrfwjf9834cd&_render=rss` &limit=`50` ]]</ul>" and it produces a list of of the rss I have which is great. The thing is the output on the page the following:

        0: Array
        (
        [title] => Title
        [link] => http://www.url.com
        [description] => Inspection on Monday blah blah.
        [guid] => http://www.url.com
        [pubdate] => Thu, 28 Apr 2011 07:28:45 +0000
        [summary] => Inspection on Monday blah blah.
        [date_timestamp] => 1303975725
        )
        1: Array
        (
        [title] => Title
        [link] => http://www.url.com
        [description] => Getting along with blah blah.
        [pubdate] => Wed, 11 May 2011 20:13:00 +0000
        [category] => wellness
        [summary] => Getting along with blah blah.

        [date_timestamp] => 1305144780
        )


        But, how do I style array list so it doesnt display oddly? Im kind of looking for a way to wrap these tags with divs or a table or something. Hope that makes sense?

          • 26503
          • 620 Posts
          Hi Chaps;

          you have to specify an output chunk - the default is to just dump the array if no chunk is specified,
          Here’s what I have for my google calendar feed:

          note the tpl...
          [[!getFeed? 
          	&url=`http://www.google.com/calendar/feeds/info.oncologyeducation%40gmail.com/public/basic`
          	&limit=`12`
          	&tpl=`GoogleCalendarFeed`
          ]]
          



          this is the GoogleCalendarFeed chunk, the "IF" is just filtering out private items.
          [[!If?
          	&subject=`[[+title]]`
          	&operator=`EQ`
          	&operand=``
          	&then=`[[+title]]`
          	&else=`
          		<div class="google-calendar"> 
          			<ul>
          				<li><a href="[[+link]]"><h5>[[+title]]</h5></a></li>
          				<li>[[!ParseGoogleSummary? &input=`[[+summary]]`]]</li>
          			</ul>
          		</div>
          	`
          ]]
          
          


          Note the variables I am using there correspond to the keys you see in your array dump, i.e. you can use:’title, link, description...etc’

          -sean
            *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

            Sean Kimball CLP, CLS.
            Technical Director / Sr. Developer | BigBlock Studios
            ._______________________________________________.
            Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
            27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
            phone/fax: 905-426-5525
            • 4948
            • 33 Posts
            Thanks Sean,

            A tpl chunk has done it for me. Thanks for the example.

            Chaps
              • 24393
              • 83 Posts
              I was just updating my site to use getFeed with google calendar and thought this might be useful to someone following this thread.

              You can add the following query parameter to your feed URL:

               ?sortorder=starttime 


              Full sorting/filtering options are here: http://code.google.com/apis/calendar/data/2.0/reference.html#Parameters

              I also wanted to reverse the order of the events which I did by adding this code to the getFeed snippet around line 45, although I’m sure there’s a better way to "parameter-ize" this:

               $output = array_reverse($output);
                stevesunderland.com
                GRAPHICS | INTERACTIVE | MARKETING
                xhtml + ajax + seo websites powered by modx
                • 26503
                • 620 Posts
                Nice find Steve ... thanks, this will be useful.
                  *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                  Sean Kimball CLP, CLS.
                  Technical Director / Sr. Developer | BigBlock Studios
                  ._______________________________________________.
                  Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                  27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                  phone/fax: 905-426-5525
                  • 37143
                  • 74 Posts
                  Hi Sean. If possible, would you mind sharing that [[!ParseGoogleSummary? snippet you referenced? Thanks for your replies and info on this thread.
                    • 36426
                    • 197 Posts
                    Hi everyone. I hope someone can help. I'm trying to display an rss feed with getfeed but I'm receiving this error:

                    Warning: MagpieRSS: Failed to fetch app.mysquawkbox.com/feed/w7IZLIGoMJOpWt--pdbd++g==%250A.rss (HTTP Error: Invalid protocol "") in /home/yorkweb1/public_html/shepherdbeamish/core/model/modx/xmlrss/rssfetch.class.php on line 237


                    Here is my snippet call:

                    [[!getFeed? &url=`app.mysquawkbox.com/feed/w7IZLIGoMJOpWt--pdbd++g==%250A.rss`]]


                    Also tried:

                    [[!getFeed? &url=`http://app.mysquawkbox.com/feed/w7IZLIGoMJOpWt--pdbd++g==%250A.rss`]]


                    Does anyone know how to fix this? Many thanks for your help.
                      Yorkshire UK based hosting provider: https://www.simulant.uk
                      • 7391
                      • 49 Posts
                      I'm getting the same error! Not sure why. Works fine with other feeds.. just the google cal xml feed.