I'm using xpath to grab information from a document, the only issue is I havn't been able to combine them into 1 for loop so the information displays correctly on the page. My code is:
<?php
$doc = new DOMDocument;
$doc->preserveWhiteSpace = FALSE;
$doc->load('http://mdoerrdev.com/xml/updates-mits.xml');
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('MITS', "http://www.mitsproject.org/namespace");
$unitName = $xpath->evaluate("//ILS_Unit[@FloorplanID='550584']/Unit/MITS:MarketingName");
$unitPrice = $xpath->evaluate("//ILS_Unit[@FloorplanID='550584']/Unit/MITS:Information/MITS:MarketRent");
?>
<div class="unit-name">
<?php
foreach ($unitName as $un) {
echo $un->nodeValue . "\n";
}
?>
</div>
<div class="floor-plan-box fpb-one-bedroom cleafix"> <?php
foreach ($unitPrice as $up) {
echo $up->nodeValue . "\n";
?><img src='<?php bloginfo('stylesheet_directory'); ?>/img/floorplans/<?php echo "550584" ?>.jpg' /> <?php
};
?>
</div>
(from: http://pastie.org/8360106)
I need to combine the MarketRent and MarketingName information together as opposed to having them display separately as they do in the current code.