'; if ($mode == 'showreview') { // We're showing a review ... if (($name == 'REVIEW') && ($info['FILE'] == $filename)) { // We're showing _this_ review echo '

'; if ($info['URL']) { echo ''; } echo ''.$info['TITLE']; if ($info['TITLE'] && $info['AUTHOR']) { echo ' by '; } echo $info['AUTHOR'].''; if ($info['URL']) { echo ''; } if ($info['BUYURL']) { echo '  Buy it now!'; } if ($info['REVAUTH'] || $info['DATE']) { echo '
('; if ($info['REVAUTH']) { echo 'Review by '.$info['REVAUTH'].' '; if ($info['DATE']) echo ' - '; } if ($info['DATE']) { $date = date('j<\sup>S M Y', strtotime($info['DATE'])); echo 'Added on '.$date; } echo ')

'; } includeFile('reviews/'.$filename.'.html'); } } else if ($mode != 'index') { // Assume we're trying to display things if ($name == 'REVIEW') { if (($mode == 'all') || ($info['SHOW']) ) { // This is a review we want echo ''.$info['TITLE']; if ($info['TITLE'] && $info['AUTHOR']) { echo ' by '; } echo $info['AUTHOR']; echo ''; if ($info['REVAUTH'] || $info['DATE']) { echo '
('; if ($info['REVAUTH']) { echo 'Review by '.$info['REVAUTH'].' '; if ($info['DATE']) echo ' - '; } if ($info['DATE']) { $date = date('j<\sup>S M Y', strtotime($info['DATE'])); echo 'Added on '.$date; } echo ')
'; } echo '
'; } } } $currentTag = ""; } // process data between tags function characterData($parser, $data) { global $info, $counts, $currentTag, $mode, $lastDate, $cats, $auths, $select; if ($mode == 'index') { if ($currentTag == 'CAT') { $counts[$data] ++; if ((!$cats[$data]) || ($cats[$data] < $lastDate)) { $cats[$data] = $lastDate; }; } else if ($currentTag == 'REVAUTH') { $counts[$data] ++; if ((!$auths[$data]) || ($auths[$data] < $lastDate)) { $auths[$data] = $lastDate; }; } else if ($currentTag == 'DATE') { $lastDate = strtotime($data); } } else { if ($currentTag == $select) { if ($mode == $data) { $info['SHOW'] = true; } } else { $info[$currentTag] = $info[$currentTag].$data; } } } // // *** End of XML control content *** // // // *** Code to generate content *** // // Include the header; head($style, 'Reviews', ''); // initialize parser $xml_parser = xml_parser_create(); $file = 'content/reviews.xml'; if ($mode == 'index') { ?>

Want to know what we think of the things, then check out our reviews. You can select a set of reviews either by category ...

Listing all reviews ...

'; } else if ($select == 'REVAUTH') { // Author mode echo '

Listing all reviews by '.$mode.'...

'; } else { // Catagory mode echo '

Listing all reviews of '.$mode.'...

'; } } // set callback functions xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); // open XML file if (!($fp = fopen($file, "r"))) { die("Cannot locate XML data file: $file"); } // read and parse data while ( ($data = fgets($fp, 4096)) ) { // error handler if (!xml_parse($xml_parser, $data, feof($fp) )) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } // clean up xml_parser_free($xml_parser); if ($mode == 'index') { echo '

... or select a set of reviews by one author ...

If that doesn'."'".'t help then click here to view all reviews.

'; } else { // Not index mode echo '

Return to index page

'; } foot($style); ?>