<?php
$menu = apc_fetch('menu');
if(!$menu) {
$dom = domxml_open_file('menu.xml');
$root = $dom->document_element();
$node = $root->first_child();
$i=0;
while($node) {
$subnode = $node->first_child();
while($subnode) {
if(isset($subnode->tagname)) {
$menu[$i][$subnode->tagname] = $subnode->get_content();
}
$subnode = $subnode->next_sibling();
}
$i++;
$node = $node->next_sibling();
}
apc_store('menu',$menu);
}
foreach($menu as $item) {
echo <<<EOT
<div style="background-color:teal;color:white;padding:4px">
<span style="font-weight:bold;color:white">$item[name]</span>
- $item[price]
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
$item[description]
<span style="font-style:italic">($item[calories] calories per serving)</span>
</div>
EOT;
}
?>