Accessing properties on a PHP array of objects #5945
-
Hello Statafriends. I'm adding a feed section to my website. Made a controller that curls out to a url and pulls a JSON feed in. When I parse and pass it into the (antlers) template, I can see the div containers for the ten entries being rendered out, but it seems like I can't access the properties inside of each of those ten objects. I really don't see why this should work much differently than a collection of objects fetched from a collection within the CMS. Seems like an antlers oddity, but couldn't find much discussion about using standard php arrays within antlers to see if there are any gotchas to be aware of. Controller:
View:
Adding an {{ f | dump }} inside of the foreach dumps out all of the properties of the object, and all as expected. JSON comes in as such:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
What about if you try something like this: {{ feed }}
{{ user_info:name }}
{{ /feed }} Also: three back ticks at start and finish will give you proper code formatting (like my above one) 😉 |
Beta Was this translation helpful? Give feedback.
What about if you try something like this:
Also: three back ticks at start and finish will give you proper code formatting (like my above one) 😉