You are here: Re: recursive search path class « PHP Language « IT news, forums, messages
Re: recursive search path class

Posted by Jean Pierre Daviau on 02/16/07 22:13

Better
==================== classe import_class
============================

class import_class {
var $basepath;
var $classe;
var $safepath;

function import_class($input){
if(strstr($input, ".php")){
$this->classe = $input;
$this->path = str_replace('\\', '/', getcwd());
$this->basepath = $this->path;
$this->safepath = $this->basepath;
print "constructorInput: $this->safepath \n";
}else{
$this->safepath = $this->basepath . $input;
print "constructorInput: $this->safepath\n";
}

}

function OpenAllDir()
{
$cpt = 0;

// On ouvre le dossier
$dossier = opendir($this->safepath);

// On parcourt le dossier
while($dir = readdir($dossier))
{
// .. le dossier au-dessus
if(is_dir($dir) && $dir != '.' && $dir != '..')
{
$PathToRepertoire = str_replace($PathToRepertoire, '.', '' );
$this->safepath = $this->basepath . $PathToRepertoire . "/" .
$dir;
//print "OpenAllDir: $this->safepath\n";

$instance = new import_class ($this->safepath);
$instance->OpenAllDir();
}

if ($dir === $this->classe) {
$this->basepath = $this->basepath;
print "Le fichier $dir existe\n";
break;
}
print "$dir\n";
}

closedir($dossier);
}

}//fin de classe

$nw = new import_class("haha.php");
$nw->OpenAllDir();
================================= end class ==================
| C:/PHP/commandLine/
| +Part_1 |
+node1
| +Part_2
| +node2
| +file to find

==============================

constructorInput: C:/PHP/commandLine
..
...
etc

constructorInput: C:/PHP/commandLine/Part_1
..
...
etc
node1
etc

constructorInput: C:/PHP/commandLine/Part_2
..
...
etc
node2
etc
======================
normal termination
===========


constructorInput: C:/PHP/commandLine/Part_1/node1
&
constructorInput: C:/PHP/commandLine/Part_1/node2

are not printed

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация