        
                                                                                    

                                                                                        


<?php
//-->-->-->-->-->-->-->-->
   $sLibraryPath = '/usr50/home/retrovox/public_html/product-data/lib';
   require "$sLibraryPath/RETROVOX-CONSTANT-VARIABLES.php";  
   require "$sLibraryPath/fnRetrovoxParseXml.php";
   require "$sLibraryPath/fnRetrovoxStartHtml.php";

   require "$sLibraryPath/fnRetrovoxParseCategoryDescription.php";
   require "$sLibraryPath/fnRetrovoxParseCategoryPaths.php";
   require "$sLibraryPath/fnGetUniquePathList.php";
   
   $sCategoryDataFile = 
     '/usr50/home/retrovox/public_html/product-data/category-data.xml';


   $sDataPath = '/usr50/home/retrovox/public_html/product-data';
   $sProductId = $_GET["product"];
   $sFilePath = "$sDataPath/product-$sProductId.xml";
   

   //$aaProductData = parse_ini_file($sFilePath);
   //echo "short-description=".$aaProductData["short-description"];


   //$sProductData = implode('', file($sFilePath));
   //$aaProductData = fnRetrovoxParseXml($sProductData);

   $sImageList = "
/Images/xx-nice-valve-6af6g-blue-249x400.jpg 
/Images/xx-nice-valve-6f8g-balsa-222x600.jpg 
/Images/xx-nice-valve-6l6gcv1947-143x350.jpg 
/Images/xx-nice-valve-6z4-171x418.jpg 
/Images/xx-nice-valve-813-blue-259x649.jpg 
/Images/xx-nice-valve-am5z4g-333x801.jpg 
/Images/xx-nice-valve-and-pack-blue-379x400.jpg
/Images/xx-nice-valve-and-pack-yellow-400x553.jpg
/Images/xx-nice-valve-cv1186-400x627.jpg 
/Images/xx-nice-valve-cv3885-blue-161x400.jpg 
/Images/xx-nice-valve-cv8286-397x861.jpg 
/Images/xx-nice-valve-cv9167-400x118.jpg 
/Images/xx-nice-valve-rca829-blue-219x400.jpg";
  $aaImageList = explode("\n", $sImageList);
  srand((float) microtime() * 10000000);
  $iRandomArrayElementIndex = array_rand($aaImageList, 1);
  $sRandomImageFilePath = $aaImageList[$iRandomArrayElementIndex];


//--<--<--<--<--<
?>

<?= fnRetrovoxStartHtml("A List of Retrovox Products", 
                        "/product-data/retrovox-style.css") ?>

      <img src = '<?=$sRandomImageFilePath?>' 
         width = '180' align = 'left' alt = 'an interesting tube'>
      
      <table  border = '0' cellspacing = '0' cellpadding = '0'
             summary = 'a list of retrovox products'>
      <tr bgcolor = 'white'>
          <td><strong>ID</strong></td>
          <td><strong>Product Name</strong></td>
          <td><strong>action</strong></td>
          <td><strong>action</strong></td></tr>

<?php
//-->-->-->-->-->-->-->-->
     $iCurrentProductId = 0;
     $sExtractedId = '';    //-- to get the product-id from the file name
     $sFileContents = '';
     $aaProductData = '';
     $iCount = '0';         //-- used to shade alternate rows of display table

     $dh  = opendir($sDataPath);
     while (false !== ($sCurrentFileName = readdir($dh)))
     {
       $sExtractedId = 
        str_replace('.xml', '', str_replace('product-', '', $sCurrentFileName));
        if (is_numeric($sExtractedId))
        {
          $iCurrentProductId = $sExtractedId;
          $sFileContents = implode('', file($sDataPath."/".$sCurrentFileName));
          $aaProductData = fnRetrovoxParseXml($sFileContents);
          if (($iCount % 2) == 0)
            { $sBackgroundColour = "#ffffff"; }
          else
            { $sBackgroundColour = "#efefef"; }

          echo "
           <tr bgcolor = \"$sBackgroundColour\"><td>".
                 $aaProductData['product-id']."&nbsp;&nbsp;</td><td>".
                 $aaProductData['product-name'].
            "</td><td><a href = '/product-data/display-product.php?product=".
            $aaProductData['product-id']."'>view page</a>&nbsp;|</td><td>&nbsp;
            <a href = '/product-data/display-product-tabular.php?product=".
            $aaProductData['product-id']."'>
            view data</a>&nbsp;&nbsp;</td></tr>";
            $iCount++;
         } //-- if is product data file
      } //-- while more files

//--<--<--<--<--<--<--<--<
?>
   </table>
   
</body>
</html>
                                                                                        