I am attempting to pull the XML from Amazon in, but I am having a problem with
the image portion. There are some products that do not have images defined. I
have attempted to use
<cfif
IsDefined('myAmazonResults.ItemSearchResponse.Items.Item[i].ImageSets.ImageSet.Tinyimage.url.xmlText')>,
but because I am looping the results to display, I am not able to get this to
work. The error I get is:
Parameter 1 of function IsDefined, which is now
myAmazonResults.ItemSearchResponse.Items.Item[i].ImageSets.ImageSet.Tinyimage.url.xmlText,
must be a syntactically valid variable name.
My code is massive, so I just put in my loop statement.
<table>
<cfloop from="1" to="10" index="i">
<tr>
<td>
<cfif
IsDefined('myAmazonResults.ItemSearchResponse.Items.Item[i].ImageSets.ImageSet.Tinyimage.url.xmlText')>
<img
src="#myAmazonResults.ItemSearchResponse.Items.Item[i].ImageSets.ImageSet.Tinyimage.url.xmlText#"
height="#myAmazonResults.ItemSearchResponse.Items.Item[i].ImageSets.ImageSet.Thumbnailimage.Height.xmlText#"
width="#myAmazonResults.ItemSearchResponse.Items.Item[i].ImageSets.ImageSet.Thumbnailimage.Width.xmlText#
align="left" hspace="8" vspace="8" />
</cfif>
<a
href="#CGI.SCRIPT_NAME#?asin=#myAmazonResults.ItemSearchResponse.Items.Item[i].ASIN.xmlText#">#myAmazonResults.ItemSearchResponse.Items.Item[i].ItemAttributes.Title.xmlText#</a><br
/><br /><strong> List Price:</strong>
#myAmazonResults.ItemSearchResponse.Items.Item[i].ItemAttributes.ListPrice.FormattedPrice.XMLText#<br
/><br />
</td>
</tr>
</cfloop>
</table>
Everything works fine except when there is no image defined in the XML.
Any assistance would be appreciated.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290089
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4