Hey guys, I need to somehow integrate my code for Amazon Web Services into my node template. Basically I need to know how I can automatically pick up the node title (which is an album name) and artist name and place them in my AWS script to automatically display an album cover.
I have contemplate module installed. The code that gathers and displays the artist name is as follows:
<div class="field field-type-text field-field-artist-name">
<h3 class="field-label">Artist Name</h3>
<div class="field-items">
<?php foreach ((array)$field_artist_name as $item) { ?>
<div class="field-item"><?php print $item['view'] ?></div>
<?php } ?>
</div>
</div>
The album name (node title) is:
<?php print $title ?>
The code I need to somehow import these items into is as follows. The place I need to input the data is in line 3 and 4:
<?
$accesskey = ('############');
$artist = urlencode('enter_artist_name_here');
$album = urlencode('enter_album_name_here');
$images = file_get_contents('http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId='.$accesskey.'&Operation=ItemSearch&SearchIndex=Music&ResponseGroup=Images&Artist='.$artist.'&Title='.$album.'');
include('xml.php');
$data = XML_unserialize($images);
$error = $data[ItemSearchResponse][Items][Request][Errors][Error][Message];
$smallimage = $data[ItemSearchResponse][Items][Item][0][SmallImage][URL];