Here's the class.....
class dch_dir
{
var $path;
var $handle;
var $list;
var $err;
var $os = "Unknown";
var $sep = "/";
function dch_dir() {
if(strlen($HTTP_ENV_VARS["WINDIR"])>0) {
$this->os = "Win";
$this->sep = "\\";
}
else {
/*do non-windows (UNIX / LINUX) stuff*/
$this->os = "Unix";
}
return;
}
function dch_open_dir($this->path) {
if($d = dir($this->path)){
$this->handle = $d->handle;
}
else {
$this->err .="Error opening directory or invalid path given. ";
}
return;
}
function dch_close_dir($this->handle) {
closedir($this->handle);
return;
}
}
.... and here's the instance .....
$path='/fred';
create object instance (also opens directory and associates handle)
$directory = new dch_dir;
set all data slots
$directory->path = $path;
open directory
$directory->dch_open_dir($this->path);
get contents
$directory->dch_dir_list($directory->handle);
close directory
$directory->dch_close_dir($directory->handle);
I'm just trying to get to grips with OOP so why does this "function dch_open_dir($this->path)" give me a parse error???