glasglow
Mar 25th 2009, 2:34 am
I am using this and when I am echoing there, it's coming from an array and the results are not even. For example if A goes with 1, I am getting B with 1 and c with 2 etc.. The results are uneven which I think is because of the case. Is there anyway that I can even them out on the return?
foreach ($values as $key=>$val)
{
switch ($val['tag'])
{
case 'DetailPageURL':
$DetailPageURL = $val['value'];
echo '<img border="0" src="'.$MediumImage.'" height="100">';
break;
case 'ItemAttributes':
$inItemAttributes = ($val['type'] == 'open');
echo '<h1><a href='.$DetailPageURL.'>'.$itemAttributes['Title'].'</a></h1><br>'.$itemAttributes['FormattedPrice'].'<hr>';
break;
case 'MediumImage':
$inMediumImage = ($val['type'] == 'open');
break;
case 'EditorialReview':
$inEditorialReview = ($val['type'] == 'open');
break;
case 'Content':
if ($inEditorialReview) $EditorialReview = $val['value'];
break;
case 'URL':
if ($inMediumImage) $MediumImage = $val['value'];
break;
default:
if ($inItemAttributes)
{
$itemAttributes[$val['tag']] = $val['value'];
}
}
}
//$Title = $itemAttributes['Title'];
//echo "<h1><a href=\"$DetailPageURL\">$Title</a></h1>";
//echo "<img src=\"$MediumImage\" align=\"right\">";
//echo $EditorialReview;
}
foreach ($values as $key=>$val)
{
switch ($val['tag'])
{
case 'DetailPageURL':
$DetailPageURL = $val['value'];
echo '<img border="0" src="'.$MediumImage.'" height="100">';
break;
case 'ItemAttributes':
$inItemAttributes = ($val['type'] == 'open');
echo '<h1><a href='.$DetailPageURL.'>'.$itemAttributes['Title'].'</a></h1><br>'.$itemAttributes['FormattedPrice'].'<hr>';
break;
case 'MediumImage':
$inMediumImage = ($val['type'] == 'open');
break;
case 'EditorialReview':
$inEditorialReview = ($val['type'] == 'open');
break;
case 'Content':
if ($inEditorialReview) $EditorialReview = $val['value'];
break;
case 'URL':
if ($inMediumImage) $MediumImage = $val['value'];
break;
default:
if ($inItemAttributes)
{
$itemAttributes[$val['tag']] = $val['value'];
}
}
}
//$Title = $itemAttributes['Title'];
//echo "<h1><a href=\"$DetailPageURL\">$Title</a></h1>";
//echo "<img src=\"$MediumImage\" align=\"right\">";
//echo $EditorialReview;
}