Jump to content

getting error in inheritance of class


tanveer

Recommended Posts

Hi,

After a long time I start php again to do some stuff and using OOP concept for the first time and getting this below error

PHP Fatal error:  Class 'SystemConfig' not found in /home/tanveer/Workspace/EmailTest/webapp/classes/MailParser.class.php on line 12, referer: http://localhost/EmailTest/public_html/index.php

My project directory structure is as follows:

 

\webapp:
   |- classes
          |- MailParser.class.php
          |-DatabaseConnect.class.php
          |-SystemConfig.class.php

\public_html:
     |-header.php
     |-footer.php
     |-gencsv.php
     |-stat.php
   \css
      |-style.css
   \images
      index.php

 

And the php code file that I am trying to make work is as follows:

class MailParser extends SystemConfig

{

 

/* Reads the files passed line-by-line

* @param $fileName

*/

public function readFiles($fileName){

 

$fileHandler = fopen($fileName,'r');

 

while ($line = fgets($fileHandler)) {

echo $line."<br />"; 

}

 

fclose($fileHandler);

 

}

 

 

  /* Traverse the user specified directory

  * @param $dirPath

  */

public  function traverseDirectory($dirPath)

{

echo $dirPath;

 

$sentFolderPath = new SystemConfig();

$sentFolderPath->getSentMailFolder();

 

$totalDirPath = $dirPath."/".$sentFolderPath;

echo $totalDirPath;

 

$io=0;

 

if ($handle = @opendir($dirPath))

{

while (false !== ($file = readdir($handle)))

{

if ($file != "." && $file != "..")

{

$newdir = "";

$filetext = "";

 

if (!is_file($dirPath."/".$file) or is_dir($dirPath) )

{

$io++;

 

$newdir.= $dirPath."/".$file."/";

print $newdir."<br />";

 

$this->traverseDirectory($newdir);

 

if(is_file($dirPath.$file))

{

$text =  str_replace('//','/',"".$dirPath.$file."\n");

 

}

}

}

}

 

closedir($handle);

}

}

 

}

 

$rmf = new MailParser();

$rmf->traverseDirectory($_POST["dirpath"]);

 

?>

Link to comment
https://forums.phpfreaks.com/topic/237698-getting-error-in-inheritance-of-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.