PHP Classes

File: csv2html-doc.html

Recommend this page to a friend!
  Classes of Srinivasan Ramakrishnan   csvtohtml   csv2html-doc.html   Download  
File: csv2html-doc.html
Role: ???
Content type: text/plain
Description: Documentation for csvtohtml in PHP manual style
Class: csvtohtml
Converts a CSV file into a HTML table
Author: By
Last change:
Date: 23 years ago
Size: 2,536 bytes
 

Contents

Class file image Download
<!DOCTYPE html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>CSV2HTML - Documentation</TITLE> </HEAD> <BODY bgcolor="#FFFFFF"> <P> <H1>csvtohtml</H1> (PHP3 &gt;= 3.0.8, PHP4)<BR> csvtohtml -- Converts a CSV file to a HTML table <P></P> <BR> <P><B>Description:</B></P> <TABLE width="100%" border="0" bgcolor="#CCCCCC"> <TR> <TD> <CODE>&string [&boolean] &csvtohtml(string $csvFilePath, string $htmlFilePath, int $maxRowLength, string $htmlTableStyle [, string $delimiterString = ","])</CODE> </TD> </TR> </TABLE> <P> <PRE>string $csvFilePath</PRE> - Must point to a valid CSV file path <P></P> <P> <PRE>string $htmlFilePath</PRE> - The output HTML file destination path, NULL if output is to be only as return value. <P></P> <P> <PRE>int $maxRowLength</PRE> - The max number of characters on any line in the CSV file <P></P> <P> <PRE>string $htmlTableStyle</PRE> - The HTML style elements in a table, can be left as a zero length string for default styling as per browser <P></P> <TABLE width="75%" border="0" bgcolor="#CCCCCC"> <TR> <TD> <PRE> Ex: 'align="center" background="bg.gif" border="3"'</PRE> </TD> </TR> </TABLE> <PRE>string $delimiterString</PRE> - By default assumed as , (comma). Denotes the delimiting character between fields <P><B>Usage:</B><BR> The function will return a reference to a variable containing the HTML code for creating the table containing the CSV records.However an output HTML file path may be specified to allow output to an HTML file. The returned reference will contain a boolean false if an error occurs.</P> <P>If output need not be stored as an HTML file the <CODE>$htmlFilePath</CODE>must be set to NULL.</P> <P>Ex:</P> <TABLE width="75%" border="0" bgcolor="#CCCCCC"> <TR> <TD> <PRE> $output = &amp;csvtohtml("test.csv", NULL, 1000, "border='0'", ";"); csvtohtml("test.csv", "test.html", 1000, "border='0'", ";"); $output = &amp;csvtohtml("test.csv", "test.html", 1000, ""); </PRE> </TD> </TR> </TABLE> <P><b>Example:</b></P> <table width="75%" border="0" bgcolor="#CCCCCC"> <tr> <td> <pre> &lt;?php include("csv.inc"); $output = &csvtohtml("addbook2.csv", "test.html", 1000, 'bgcolor="#cccc66" align="center" width="50%" border="0" valign="middle"'); csvtohtml("addbook3.csv", "xvb.html", 1000, ""); echo $output; ?&gt;</pre> </td> </tr> </table> <P>&nbsp;</P> </BODY> </HTML>