PHP Classes

File: Price.php

Recommend this page to a friend!
  Classes of Stanislav Karchebny   CsvParser   Price.php   Download  
File: Price.php
Role: Example script
Content type: text/plain
Description: Demo price list generator
Class: CsvParser
Simple CSV parser
Author: By
Last change:
Date: 21 years ago
Size: 806 bytes
 

Contents

Class file image Download
<?php

// csv2price generator
// (c) 2002 Berkus

include("CsvParse.php");

function
gen_price_list($file)
{
  
$csv = new CsvParser($file, false, ';');

?> <table cellpadding="1" cellspacing="1" border="0" width="80%"> <?
  
for ($k = 0; $k < $csv->numRecords; $k++)
   {
     
$rec = $csv->getRecord($k);

      if (
$rec[0] == '1') { // header
?> <tr>
         <td colspan="2" bgcolor="#000000"><div class="priceHead"><font color="#E0E0E0"><b><?=$rec[2]?></b></font></div></td>
      </tr> <?
     
}
      else if (
$rec[1] == '1') { // item
?> <tr bgcolor="#E0E0E0">
         <td align="left"><div class="priceItem1"><?=$rec[2]?></div></td><td align="right"><div class="priceItem2"><nobr><?=$rec[3]?></nobr></div></td>
      </tr> <?
     
}
   }
?> </table> <?
}

?>