Forum


Replies: 8   Views: 6174
Phpdocx 2.5 installation problem
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by philippe.stora  · 11-04-2013 - 12:13

Notice: Undefined variable: newName in C:\wamp\projets\sandbox\www\[etc...]\phpdocx_pro\classes\CreateDocx.inc on line 5885

Okay, let's go and see that (It's non blocking but I hate notice :-) )

/**
*
* Adds directory contents recursively into a zip.
*
* @param string $dirName. The path to the dir to add.
*
* @param string $myZip. The zip where the contents of the dir should be added.
*
*/
private function recursiveInsert($myZip, $fileName, $basePath){
$length = strlen($basePath);
if(is_dir($fileName)){
$dirName = substr($fileName, $length);
$myZip->addEmptyDir($newName); // <=== HERE ! undefined $newName ... to be replaced by $dirName, isn't it ?? :-)
$contentsDir = scandir($fileName);
foreach($contentsDir as $element){
if($element != "." && $element !=".."){
$this->recursiveInsert($myZip, $fileName."/".$element, $basePath);
}
}
}else{
$newName = substr($fileName, $length + 1);
$myZip->addFile($fileName, $newName);
}
}