I am trying to use the Placid plugin to retrieve track-names from an external service, and having problems. I have the following code:
{% for song in craft.entries.section('music') %}
{% set params = { 'id' : song.itunesId } %}
{% set lookup = craft.placid.get('itunesMusic', { params : params } ) %}
{% for track in lookup.results %}
{{ track.trackName }}
{% endfor %}
{% endfor %}
The values of song.itunesId
and params
seem to be set correctly, however lookup.results
is returning the same track.trackName
on each iteration of the loop.
loop.index
increments, and so does mysong.itunesId
when I set them up like{{ song.itunesId }}
, but inside the loop it's not resetting the value of params to the newsong.itunesId
.{{ track.trackName }}
only displays the firstsong
track name (in the case the track name is Bless Your Name, so it outputs Bless Your Name twice), but if I put{{ song.itunesId }}
in the first loop, it iterates over both values. Is there any way to make sure both of theset
values reset for each iteration of the loop, instead of "sticking"?placid.get
method isn't taking the new variable each time in the loop. Basically, I'm just trying to get the id I added in an entry and put it on the end of the iTunes Search api, i.e. itunes.apple.com/lookup?id=721273648
, where the last number is different. That is weird that it doesn't work.