Foo wrote:You can't call a method from a class without first creating an instance of that class and giving it a name.
So if you make an instance of your class 'person' and call the instance 'tempperson' you would call the method in that class that you called 'setname' like this:
$tempperson->setname( $newname )
ofcourse, I know this
Foo wrote:
If you have a method inside a class which might be called without the class, it doesn't want to be IN the class.
how do you mean this?
this is what I am trying to do:
file: foldersCL.php (holds various shit used for stuff related to folders
Code: Select all
class directory {
private $origumask = NULL;
private $oldumask = NULL;
private $newDir = NULL;
public function makeDir($dir){
$this->oldumask = umask(0);
$this->newDir = @mkdir($dir, 0777); //make new tmp directory
$this->origumask = umask($this->oldumask);
}
}?>
I am calling the method in another class inside the file imageCL, which holds my image resize and display stuff
the bit that doesn't work:
Code: Select all
public function setSaveFolder($folder){
$this->saveFolder = $folder;
if (!empty($this->saveFolder) && !is_dir($this->saveFolder)){ //create the directory if it does not exist
$dir = new directory();
$dir->makeDir($this->saveFolder);
}
}
it throws me a method undefined error for the makeDir() method
all classes are autloaded so no worries there