PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of André Cupini   Splitter   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example File
Class: Splitter
Split lines and columns of text files
Author: By
Last change:
Date: 19 years ago
Size: 1,670 bytes
 

Contents

Class file image Download
<style>
TABLE, TD{
  BORDER: GROOVE;
  FONT-FAMILY: COURIER NEW;
  FONT-SIZE: 13PX;
}
TH {
  BACKGROUND-COLOR: #666666;
  FONT-FAMILY: COURIER NEW;
  FONT-SIZE: 13PX;
  COLOR: #FFFFFF;
}
</style>
<body topmargin='0' leftmargin='0'>
<table width='100%' border='0' cellpadding="0" cellspacing="0">
  <tr>
    <th>First Line As Field (Index Type: LINE)</th>
    <th>Classic (Index Type: LINE)</th>
  </tr>
  <tr>
    <?
   
require_once(dirname(__FILE__) ."/Splitter.class.php");
   
   
// The first line in the file are the fields names
   
$Splitter = new Splitter("example_1.txt");
   
$Splitter->setFirstLineAsField(TRUE);
   
$Splitter->split();
    print
"<td valign='top'><pre>"; print_r($Splitter->content); print "</pre></td>";
   
   
// Classic
   
$Splitter = new Splitter("example_2.txt");
   
$Splitter->split();
    print
"<td valign='top'><pre>"; print_r($Splitter->content); print "</pre></td>";
   
?>
</tr>
  <tr>
    <th>First Line As Field (Index Type: COLUMN)</th>
    <th>Classic (Index Type: COLUMN)</th>
  </tr>
  <tr>
    <?
   
// Column Index Type Example
   
$Splitter = new Splitter("example_1.txt");
   
$Splitter->setFirstLineAsField(TRUE);
   
$Splitter->setIndexType("COLUMN");
   
$Splitter->split();
    print
"<td valign='top'><pre>"; print_r($Splitter->content); print "</pre></td>";
   
   
$Splitter = new Splitter("example_2.txt");
   
$Splitter->setIndexType("COLUMN");
   
$Splitter->split();
    print
"<td valign='top'><pre>"; print_r($Splitter->content); print "</pre></td>";
   
?>
</tr>
  <tr>
    <td colspan='2' align='center'><A href='showSource.php'>&raquo; SOURCE &laquo;</a></td>
  </tr>
</table>
</body>