// open info.xml and get all data into an array
$siteInfo = simplexml_load_file("info.xml");
$prices = simplexml_load_file("pricelist.xml");
?>
if (!empty($siteInfo->promotion)) echo '' . $siteInfo->promotion . '
'; ?>
Pricelist
foreach ($prices as $item) {
// get each item tag from pricelist
$desc = (trim($item));
$price = (string)$item['price'];
$notes = (string)$item['notes'];
// check for title tags (* at start and end)
$isTitle = "";
if (substr($desc, 0, 1) == "*" && substr($desc, -1) == "*") $isTitle = ' class="title"';
echo "- " . str_replace("*", "", $desc) . "";
// show price and notes if exist
if ($price !== "") echo '' . $price . '';
if ($notes !== "") echo "{$notes}";
echo '
' . PHP_EOL;
}
?>