tyvdh/kiwi — pull request #1 by jasonvarga (2014-06-21 03:16:54+00:00)
Title: Simplified using Parse::tagLoop and array_get

Hey Tyler

I watched your video and it was great!

I thought I'd drop these edits in here to demonstrate something that might make your life easier.

`Parse::tagLoop` will do the same thing as your `foreach` and `Parse::template` loop was doing.
You just have to pass an array of arrays in. (Which is what you were getting from the API anyway)
Passing `true` as the third argument will 'supplement' it, which means it'll add iteration values to your loop like `count`, `total_results`, etc.

I also added in `array_get` which is a helper to grab variables from an array.

* The first argument is the array (or haystack)
* The second is the value you want to get (needle).
* It also accepts a third argument which would be a fallback value if what your looking for doesn't exist (I haven't needed to use that here).

The second parameter can look for nested values if you colon separate them, like `results:collection`.
In this case I'm concatenating them with your `$collection` variable. Maybe thats more confusing... Not sure.

_Also note that I edited this directly on Github and didn't test it. So there's a chance I made a typo or something. Try testing it locally before accepting this. :)_