Search code examples
phptemplatesmodxmodx-revolution

Confused on how to move through an Array (getFeed)


I don't know MODX, and the docs aren't clicking. I am using getFeed, https://docs.modx.com/extras/revo/getfeed, and i have the following code:

[[!getFeed?
   &url=`http://twitter.com/statuses/user_timeline/123456789.rss`
   &tpl=`rssTpl`
   &limit=`3`
]]

I use this, I get an array, so I know it works, but I'm not sure how to loop through this data to display. It just looks like a var_dump() otherwise.

I am having trouble finding what to do with the rssTpl. Where does it go?.

My .tpl file:

<div class="entry">
    <p><a href=[[+link]]>[[+title]]</a></p>
    <p>[[+description]]</p>
</div>

Also the template this goes in is static, and displays correctly. Do I have to something similar to the .tpl files?


Solution

  • rssTpl refers to a chunk. You say it's a .tpl file, but you'll need to make sure it's a chunk in MODX as well. Adding a chunk is done in the Elements tab of the manager sidebar.

    When it's there, I believe your template should work fine with getFeed.

    According to the example you seem to be using, Twitter did stop supporting those RSS feeds, so that might also be getting in your way.