include_once("include.php"); // get the category to display from the URL // and clean it up $cat = str_replace("/","",$_SERVER['PATH_INFO']); $cat = str_replace(".","",$cat); if ($cat=='') { $cat = 'default'; } //$xpath = xpath_new_context($doc); $doc = simplexml_load_file($xmlfile); $xpresult = $doc->xpath( "//category"); $xpresult = $doc->xpath( "//category[@name='$cat']"); if (!$xpresult) { include("badcat.php"); } $catdesc = $xpresult[0]->description; $cattitle = $xpresult[0]->title; // get all the items in this category #$xpresult = xpath_eval($xpath, "//category[@name='$cat']/items/item"); $xpresult = $doc->xpath("//category[@name='$cat']/items/item"); // dump all nodes directly in plain text if (is_array($xpresult)) { foreach ($xpresult as $node) { $child = $node; $key = $node['key']; $new = $node['new']; $xpresult2 = $doc->xpath("//category[@name='$cat']/items/item[@key='$key']"); $name = $xpresult2[0]->name; $desc= $xpresult2[0]->description; $price= $xpresult2[0]->price; $code= $xpresult2[0]->code; $name = str_replace("Marie Antoinette Number", "N°",$name); // $xpresult2 = xpath_eval($xpath, "//category[@name='$cat']/items/item[@key='$key']/description"); // $desc = $xpresult2->nodeset[0]->get_content(); // $xpresult2 = xpath_eval($xpath, "//category[@name='$cat']/items/item[@key='$key']/price"); // $price = $xpresult2->nodeset[0]->get_content(); // $xpresult2 = xpath_eval($xpath, "//category[@name='$cat']/items/item[@key='$key']/code"); // $code = $xpresult2->nodeset[0]->get_content(); if($items["$code"]['new']=='') { $items["$code"]['new'] = $new; } $items["$code"]['name'] = $name; $items["$code"]['key'] = $key; $items["$code"]['code'] = $code; $items["$code"]['cost'] = $price; $items["$code"]['desc'] = $description; } } #echo "
"; #print_r($items); #echo ""; ?> include("header.php"); ?>
$current++; if ($current==$max) { $current=0; echo " |
$current++; if ($current==$max) { $current=0; echo " |
"; $current++; } echo " |