Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Patrick Frey  >  Display Logfile  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example script
Class: Display Logfile
Display and format the lines of log files
Author: By
Last change:
Date: 2005-01-14 03:12
Size: 1,221 bytes
 

Contents

Class file image Download
<? 
   
// Include & Call Class
   
include_once("class.displayLogfile.php");
   
$lfDispl = new displayLogfile;

   
// Path/Name of Logfile
   // Choose a short one for example b (!) 
   
$filename "./logs/access.log";




   
// Example a: ///////////////////////////////
?>
<pre style="font-size:10px;">
<?
   $lfDispl
->setRowsToRead(100);    // Read 100 rows
   
$lfDispl->setAlign("top");       // Last row on top
   
$lfDispl->setFilepath($filename); // from this logfile
   
$lfDispl->setLineBreak(150);  // Break the row after 150 chars
   
$lfDispl->returnFormated();   // Output 
?>
</pre>
<?
  
/////////////////////////////////////////////////



   // Example b: (We read the Whole File into an array) ///
   
$lfDispl->setAlign("bottom");      // Last row on bottom
   
$lfDispl->setFilepath($filename); // from this logfile
   
$countRows $lfDispl->rowSize();    // Count the rows (allways the complete file)
   
$rowArray  $lfDispl->readRows();   // All Rows in array 
        
   
   // Debug output:
   
echo "File got ".$countRows." Rows <br />";
   echo 
"<pre>";
   
print_r($rowArray);
   echo 
"</pre>";



   
/////////////////////////////////////////////////

?>