File: example.php

Recommend this page to a friend!
  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: 16 years ago
Size: 1,221 bytes



Class file image Download
// Include & Call Class
$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;">
->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

   // 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 />";



For more information send a message to info at phpclasses dot org.